On 09/05/2013 08:05 AM, Richard Biener wrote:

This C++-ifies and moves the control dependence code from tree-ssa-dce.c
to cfganal.c as I am about to re-use that code from loop distribution.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2013-09-05  Richard Biener  <rguent...@suse.de>

        * basic-block.h (class control_dependences): New.
        * tree-ssa-dce.c (control_dependence_map): Remove.
        (cd): New global.
        (EXECUTE_IF_CONTROL_DEPENDENT): Remove.
        (set_control_dependence_map_bit, clear_control_dependence_bitmap,
        find_pdom, find_control_dependence, find_all_control_dependences):
        Move to cfganal.c.
        (mark_control_dependent_edges_necessary, find_obviously_necessary_stmts,
        propagate_necessity, tree_dce_init, tree_dce_done,
        perform_tree_ssa_dce): Adjust.
        * cfganal.c (set_control_dependence_map_bit,
        clear_control_dependence_bitmap, find_pdom, find_control_dependence,
        find_all_control_dependences): Move from tree-ssa-dce.c and
        implement as methods of control_dependences class.
        (control_dependences::control_dependences): New.
        (control_dependences::~control_dependences): Likewise.
        (control_dependences::get_edges_dependent_on): Likewise.
        (control_dependences::get_edge): Likewise.
I like it. I'd actually moved the control dependence stuff out of DCE in the past as well, but never pushed it upstream. I actually put it into its own files which were trivially small.

This was done in the context of implementing Click's GCM algorithm -- in the end the GCM bits didn't do significantly better than the existing sinking code at moving stuff onto more control dependent paths (after fixing minor oversights in our existing code).

Jeff

Reply via email to