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
This commit is contained in:
parent
46cb04410d
commit
592c303da8
|
@ -1,3 +1,18 @@
|
||||||
|
2007-08-01 Zdenek Dvorak <ook@ucw.cz>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2007-08-01 Zdenek Dvorak <ook@ucw.cz>
|
2007-08-01 Zdenek Dvorak <ook@ucw.cz>
|
||||||
|
|
||||||
* doc/invoke.texi (l1-cache-size): Update documentation.
|
* doc/invoke.texi (l1-cache-size): Update documentation.
|
||||||
|
|
|
@ -170,7 +170,8 @@ enum
|
||||||
LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS = 4,
|
LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS = 4,
|
||||||
LOOPS_HAVE_RECORDED_EXITS = 8,
|
LOOPS_HAVE_RECORDED_EXITS = 8,
|
||||||
LOOPS_MAY_HAVE_MULTIPLE_LATCHES = 16,
|
LOOPS_MAY_HAVE_MULTIPLE_LATCHES = 16,
|
||||||
LOOP_CLOSED_SSA = 32
|
LOOP_CLOSED_SSA = 32,
|
||||||
|
LOOPS_NEED_FIXUP = 64
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LOOPS_NORMAL (LOOPS_HAVE_PREHEADERS | LOOPS_HAVE_SIMPLE_LATCHES \
|
#define LOOPS_NORMAL (LOOPS_HAVE_PREHEADERS | LOOPS_HAVE_SIMPLE_LATCHES \
|
||||||
|
|
|
@ -891,12 +891,7 @@ execute_function_todo (void *data)
|
||||||
/* Always cleanup the CFG before trying to update SSA. */
|
/* Always cleanup the CFG before trying to update SSA. */
|
||||||
if (flags & TODO_cleanup_cfg)
|
if (flags & TODO_cleanup_cfg)
|
||||||
{
|
{
|
||||||
bool cleanup;
|
bool cleanup = cleanup_tree_cfg ();
|
||||||
|
|
||||||
if (current_loops)
|
|
||||||
cleanup = cleanup_tree_cfg_loop ();
|
|
||||||
else
|
|
||||||
cleanup = cleanup_tree_cfg ();
|
|
||||||
|
|
||||||
if (cleanup && (cfun->curr_properties & PROP_ssa))
|
if (cleanup && (cfun->curr_properties & PROP_ssa))
|
||||||
flags |= TODO_remove_unused_locals;
|
flags |= TODO_remove_unused_locals;
|
||||||
|
|
|
@ -596,8 +596,8 @@ cleanup_tree_cfg_1 (void)
|
||||||
/* Remove unreachable blocks and other miscellaneous clean up work.
|
/* Remove unreachable blocks and other miscellaneous clean up work.
|
||||||
Return true if the flowgraph was modified, false otherwise. */
|
Return true if the flowgraph was modified, false otherwise. */
|
||||||
|
|
||||||
bool
|
static bool
|
||||||
cleanup_tree_cfg (void)
|
cleanup_tree_cfg_noloop (void)
|
||||||
{
|
{
|
||||||
bool changed;
|
bool changed;
|
||||||
|
|
||||||
|
@ -632,34 +632,47 @@ cleanup_tree_cfg (void)
|
||||||
|
|
||||||
timevar_pop (TV_TREE_CLEANUP_CFG);
|
timevar_pop (TV_TREE_CLEANUP_CFG);
|
||||||
|
|
||||||
|
if (changed && current_loops)
|
||||||
|
current_loops->state |= LOOPS_NEED_FIXUP;
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Repairs loop structures. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
repair_loop_structures (void)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
|
||||||
|
BITMAP_FREE (changed_bbs);
|
||||||
|
|
||||||
|
#ifdef ENABLE_CHECKING
|
||||||
|
verify_loop_structure ();
|
||||||
|
#endif
|
||||||
|
scev_reset ();
|
||||||
|
|
||||||
|
current_loops->state &= ~LOOPS_NEED_FIXUP;
|
||||||
|
}
|
||||||
|
|
||||||
/* Cleanup cfg and repair loop structures. */
|
/* Cleanup cfg and repair loop structures. */
|
||||||
|
|
||||||
bool
|
bool
|
||||||
cleanup_tree_cfg_loop (void)
|
cleanup_tree_cfg (void)
|
||||||
{
|
{
|
||||||
bool changed = cleanup_tree_cfg ();
|
bool changed = cleanup_tree_cfg_noloop ();
|
||||||
|
|
||||||
if (changed && current_loops != NULL)
|
if (current_loops != NULL
|
||||||
{
|
&& (current_loops->state & LOOPS_NEED_FIXUP))
|
||||||
bitmap changed_bbs = BITMAP_ALLOC (NULL);
|
repair_loop_structures ();
|
||||||
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);
|
|
||||||
|
|
||||||
BITMAP_FREE (changed_bbs);
|
|
||||||
|
|
||||||
#ifdef ENABLE_CHECKING
|
|
||||||
verify_loop_structure ();
|
|
||||||
#endif
|
|
||||||
scev_reset ();
|
|
||||||
}
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -783,7 +783,6 @@ void remove_edge_and_dominated_blocks (edge);
|
||||||
/* In tree-cfgcleanup.c */
|
/* In tree-cfgcleanup.c */
|
||||||
extern bitmap cfgcleanup_altered_bbs;
|
extern bitmap cfgcleanup_altered_bbs;
|
||||||
extern bool cleanup_tree_cfg (void);
|
extern bool cleanup_tree_cfg (void);
|
||||||
extern bool cleanup_tree_cfg_loop (void);
|
|
||||||
|
|
||||||
/* In tree-pretty-print.c. */
|
/* In tree-pretty-print.c. */
|
||||||
extern void dump_generic_bb (FILE *, basic_block, int, int);
|
extern void dump_generic_bb (FILE *, basic_block, int, int);
|
||||||
|
@ -975,7 +974,7 @@ unsigned int tree_unroll_loops_completely (bool);
|
||||||
unsigned int tree_ssa_prefetch_arrays (void);
|
unsigned int tree_ssa_prefetch_arrays (void);
|
||||||
unsigned int remove_empty_loops (void);
|
unsigned int remove_empty_loops (void);
|
||||||
void tree_ssa_iv_optimize (void);
|
void tree_ssa_iv_optimize (void);
|
||||||
void tree_predictive_commoning (void);
|
unsigned tree_predictive_commoning (void);
|
||||||
|
|
||||||
bool number_of_iterations_exit (struct loop *, edge,
|
bool number_of_iterations_exit (struct loop *, edge,
|
||||||
struct tree_niter_desc *niter, bool);
|
struct tree_niter_desc *niter, bool);
|
||||||
|
|
|
@ -2582,12 +2582,13 @@ end: ;
|
||||||
|
|
||||||
/* Runs predictive commoning. */
|
/* Runs predictive commoning. */
|
||||||
|
|
||||||
void
|
unsigned
|
||||||
tree_predictive_commoning (void)
|
tree_predictive_commoning (void)
|
||||||
{
|
{
|
||||||
bool unrolled = false;
|
bool unrolled = false;
|
||||||
struct loop *loop;
|
struct loop *loop;
|
||||||
loop_iterator li;
|
loop_iterator li;
|
||||||
|
unsigned ret = 0;
|
||||||
|
|
||||||
initialize_original_copy_tables ();
|
initialize_original_copy_tables ();
|
||||||
FOR_EACH_LOOP (li, loop, LI_ONLY_INNERMOST)
|
FOR_EACH_LOOP (li, loop, LI_ONLY_INNERMOST)
|
||||||
|
@ -2598,7 +2599,9 @@ tree_predictive_commoning (void)
|
||||||
if (unrolled)
|
if (unrolled)
|
||||||
{
|
{
|
||||||
scev_reset ();
|
scev_reset ();
|
||||||
cleanup_tree_cfg_loop ();
|
ret = TODO_cleanup_cfg;
|
||||||
}
|
}
|
||||||
free_original_copy_tables ();
|
free_original_copy_tables ();
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1076,6 +1076,9 @@ thread_through_all_blocks (bool may_peel_loop_headers)
|
||||||
VEC_free (edge, heap, threaded_edges);
|
VEC_free (edge, heap, threaded_edges);
|
||||||
threaded_edges = NULL;
|
threaded_edges = NULL;
|
||||||
|
|
||||||
|
if (retval)
|
||||||
|
current_loops->state |= LOOPS_NEED_FIXUP;
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue