diff options
author | Zdenek Dvorak <ook@ucw.cz> | 2007-08-01 13:39:31 +0200 |
---|---|---|
committer | Zdenek Dvorak <rakdver@gcc.gnu.org> | 2007-08-01 11:39:31 +0000 |
commit | 592c303da820745055bf6fd1521e2b2bf1318652 (patch) | |
tree | 589e7c2e94dc0f61c32b953370ab9b08162f79ad /gcc/tree-cfgcleanup.c | |
parent | 46cb04410da4ba4fa10070a0eec7a037ff6152a7 (diff) | |
download | gcc-592c303da820745055bf6fd1521e2b2bf1318652.zip gcc-592c303da820745055bf6fd1521e2b2bf1318652.tar.gz gcc-592c303da820745055bf6fd1521e2b2bf1318652.tar.bz2 |
tree-ssa-threadupdate.c (thread_through_all_blocks): Record that the loop structures may need fixing.
* tree-ssa-threadupdate.c (thread_through_all_blocks): Record that
the loop structures may need fixing.
* tree-cfgcleanup.c (cleanup_tree_cfg_noloop, repair_loop_structures):
New functions.
(cleanup_tree_cfg_loop): Removed.
(cleanup_tree_cfg): If loops need fixing, call repair_loop_structures.
* tree-predcom.c (tree_predictive_commoning): Return TODO_cleanup_cfg
instead of running cleanup_tree_cfg_loop.
* cfgloop.h (LOOPS_NEED_FIXUP): New constant.
* tree-flow.h (cleanup_tree_cfg_loop): Declaration removed.
(tree_predictive_commoning): Declaration changed.
* passes.c (execute_function_todo): Do not use cleanup_tree_cfg_loop.
From-SVN: r127118
Diffstat (limited to 'gcc/tree-cfgcleanup.c')
-rw-r--r-- | gcc/tree-cfgcleanup.c | 53 |
1 files changed, 33 insertions, 20 deletions
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index 00fed83..c35001c 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -596,8 +596,8 @@ cleanup_tree_cfg_1 (void) /* Remove unreachable blocks and other miscellaneous clean up work. Return true if the flowgraph was modified, false otherwise. */ -bool -cleanup_tree_cfg (void) +static bool +cleanup_tree_cfg_noloop (void) { bool changed; @@ -632,34 +632,47 @@ cleanup_tree_cfg (void) timevar_pop (TV_TREE_CLEANUP_CFG); + if (changed && current_loops) + current_loops->state |= LOOPS_NEED_FIXUP; + return changed; } -/* Cleanup cfg and repair loop structures. */ +/* Repairs loop structures. */ -bool -cleanup_tree_cfg_loop (void) +static void +repair_loop_structures (void) { - bool changed = cleanup_tree_cfg (); + bitmap changed_bbs = BITMAP_ALLOC (NULL); + fix_loop_structure (changed_bbs); - if (changed && current_loops != NULL) - { - bitmap changed_bbs = BITMAP_ALLOC (NULL); - fix_loop_structure (changed_bbs); + /* This usually does nothing. But sometimes parts of cfg that originally + were inside a loop get out of it due to edge removal (since they + become unreachable by back edges from latch). */ + if ((current_loops->state & LOOP_CLOSED_SSA) != 0) + rewrite_into_loop_closed_ssa (changed_bbs, TODO_update_ssa); - /* This usually does nothing. But sometimes parts of cfg that originally - were inside a loop get out of it due to edge removal (since they - become unreachable by back edges from latch). */ - if ((current_loops->state & LOOP_CLOSED_SSA) != 0) - rewrite_into_loop_closed_ssa (changed_bbs, TODO_update_ssa); - - BITMAP_FREE (changed_bbs); + BITMAP_FREE (changed_bbs); #ifdef ENABLE_CHECKING - verify_loop_structure (); + verify_loop_structure (); #endif - scev_reset (); - } + scev_reset (); + + current_loops->state &= ~LOOPS_NEED_FIXUP; +} + +/* Cleanup cfg and repair loop structures. */ + +bool +cleanup_tree_cfg (void) +{ + bool changed = cleanup_tree_cfg_noloop (); + + if (current_loops != NULL + && (current_loops->state & LOOPS_NEED_FIXUP)) + repair_loop_structures (); + return changed; } |