This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Loop aware cfg cleanup
- From: Jeffrey A Law <law at redhat dot com>
- To: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 09 Mar 2005 09:39:25 -0700
- Subject: Re: [patch] Loop aware cfg cleanup
- Organization: Red Hat, Inc
- References: <20050303183642.GA16253@atrey.karlin.mff.cuni.cz>
- Reply-to: law at redhat dot com
On Thu, 2005-03-03 at 19:36 +0100, Zdenek Dvorak wrote:
> Hello,
>
> this patch adds cfgcleanup call after loop unswitching and complete
> loop unrolling, thus making it possible for the further loop
> optimizations to take advantage of the code simplification
> (currently, old loops are not removed during complete loop unrolling,
> the consecutive basic blocks are not merged, etc., thus making it very
> problematic for the remaining loop optimization to work with the
> affected loops).
>
> To minimize the compile time impact, rewrite_into_loop_closed_ssa
> is modified so that it only rewrites the ssa form if necessary
> (i.e. if some code is moved outside of the loop due to cfg cleanup
> call).
>
> Bootstrapped & regtested on i686 and x86_64 (with -funroll-loops
> -funswitch-loops).
>
> Zdenek
>
> * Makefile.in (tree-optimize.o): Add CFGLOOP_H dependence.
> * cfgloop.c (flow_loop_nodes_find): Export.
> * cfgloop.h (flow_loop_nodes_find, fix_loop_structure):
> Declare.
> * cfgloopmanip.c (fix_loop_structure): New function.
> * predict.c (predict_loops): Clean up the loops information.
> * tree-cfg.c (cleanup_tree_cfg_loop): New function.
> (tree_can_merge_blocks_p, remove_bb, tree_forwarder_block_p): Respect
> loop structure.
> * tree-flow.h (cleanup_tree_cfg_loop): Declare.
> (rewrite_into_loop_closed_ssa): Declaration changed.
> * tree-loop-linear.c (linear_transform_loops): Add argument to
> rewrite_into_loop_closed_ssa call.
> * tree-ssa-loop-ch.c (copy_loop_headers): Ditto.
> * tree-ssa-loop-im.c (move_computations): Ditto.
> * tree-ssa-loop.c (tree_loop_optimizer_init): Ditto.
> * tree-vectorizer.c (vectorize_loops): Ditto.
> * tree-optimize.c: Include cfgloop.h.
> (execute_todo): Choose whether to call cleanup_tree_cfg or
> cleanup_tree_cfg_loop.
> * tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables,
> (tree_unroll_loops_completely): Enable cleanup_tree_cfg_loop call.
> * tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops): Enable
> cleanup_tree_cfg_loop call.
> * tree-ssa-loop-manip.c (find_uses_to_rename_bb): New function.
> (find_uses_to_rename, rewrite_into_loop_closed_ssa): Support
> work on part of cfg.
This is fine. Please install into the mainline sources.
Thanks,
jeff