This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Remove flow_loop_scan


On Mon, 2005-02-21 at 19:48 +0100, Zdenek Dvorak wrote:
> Hello,
> 
> at the moment, flow_loop_scan duplicates functionality of other
> functions.  Concretely it provides:
> 
> LOOP_PRE_HEADER:  gets preheader of the loop (also obtainable as
>   loop_preheader_edge (loop)->src) and finds extended preheader
>   (i.e. a path of blocks that have only one successor and end in
>   preheader) -- unused.
> 
> LOOP_ENTRY_EDGES: gets entry edges of loop (there is always only
>   one entry edge, obtainable as loop_preheader_edge (loop)).
> 
> LOOP_EXIT_EDGES: Gets loop exit edges (can be also obtained from
>   get_loop_exit_edges, but often just using loop->single_exit
>   is more appropriate).
> 
> In addition to being essentially a duplicate code, the values it
> stores are not updated by loop manipulation functions, which leads
> to a risk of bugs in case someone assumes otherwise.
> 
> This patch gets rid of the function, as well as related fields in
> loop structures.
> 
> The EDGE_LOOP_EXIT --> loop_exit_edge_p transition is due to fact that
> flow_loop_exit_edges_find used to mark loop exit edges with EDGE_LOOP_EXIT.
> 
> Bootstrapped & regtested on i686, ia64, ppc and x86_64.
> 
> Zdenek
> 
> 	* cfgloop.c (flow_loop_entry_edges_find, flow_loop_exit_edges_find,
> 	flow_loop_pre_header_scan, flow_loop_pre_header_find,
> 	flow_loop_scan): Removed.
> 	(flow_loop_dump): Do not dump removed fields.
> 	(flow_loop_free): Do not free removed fields.
> 	(flow_loops_find): Flags argument removed.  Do not call flow_loop_scan.
> 	(loop_exit_edge_p): New function.
> 	* cfgloop.h (struct loop): Removed fields pre_header, pre_header_edges,
> 	num_pre_header_edges, entry_edges, num_entries, exit_edges,
> 	num_exits, exits_doms.
> 	(LOOP_TREE, LOOP_PRE_HEADER, LOOP_ENTRY_EDGES, LOOP_EXIT_EDGES,
> 	LOOP_EDGES, LOOP_ALL): Removed.
> 	(flow_loop_scan): Declaration removed.
> 	(loop_exit_edge_p): Declare.
> 	* cfgloopmanip.c (create_loop_notes): Do not pass flags to
> 	flow_loops_find.
> 	* ifcvt.c (mark_loop_exit_edges): Ditto.
> 	* loop-init.c (flow_loops_find): Ditto.
> 	* passes.c (rest_of_handle_branch_prob): Ditto.
> 	* lambda-code.c (perfect_nestify): Do not call flow_loops_find.
> 	* loop-unroll.c (analyze_insns_in_loop): Do not use
> 	EDGE_LOOP_EXIT.
> 	* predict.c (predict_loops): Do not call flow_loop_scan.
> 	Use get_loop_exit_edges.
> 	(tree_estimate_probability): Do not pass flags to flow_loops_find.
> 	* tree-if-conv.c (bb_with_exit_edge_p): Take loop as argument.
> 	Do not use EDGE_LOOP_EXIT.
> 	(tree_if_convert_cond_expr, if_convertible_modify_expr_p): Pass loop
> 	to bb_with_exit_edge_p.
> 	(if_convertible_loop_p): Do not call flow_loop_scan.  Use
> 	loop->single_exit.  Do not use EDGE_LOOP_EXIT.  Pass loop
> 	to bb_with_exit_edge_p.
> 	(combine_blocks): Pass loop to bb_with_exit_edge_p.  Do not use
> 	EDGE_LOOP_EXIT.
> 	* tree-loop-linear.c (linear_transform_loops): Do not call
> 	flow_loop_scan.  Use loop->single_exit.
> 	* tree-vect-analyze.c (vect_analyze_operations): Use loop->single_exit.
> 	(vect_analyze_loop_form): Do not call flow_loop_scan.
> 	* tree-vect-transform.c (vect_update_ivs_after_vectorizer): Use
> 	loop->single_exit.
> 	(vect_do_peeling_for_loop_bound): Use loop_preheader_edge and
> 	loop->single_exit.
> 	* tree-vectorizer.c (slpeel_update_phis_for_duplicate_loop,
> 	slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p,
> 	slpeel_tree_duplicate_loop_to_edge_cfg,
> 	slpeel_verify_cfg_after_peeling, slpeel_tree_peel_loop_to_edge):
> 	Use loop_preheader_edge and loop->single_exit.  Do not call
> 	flow_loop_scan.
So what would be the procedure to get loop exit edges marked without
having to run the entire loop optimizer?

The code to prevent the jump threader from creating irreducible regions
needs this information so that it can determine if it is safe to thread
through a block with an incoming back edge.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]