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] Removal of dead labels


On 5/1/07, Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> wrote:
Hello,

with http://gcc.gnu.org/ml/gcc-patches/2007-04/msg01840.html, most of
the tree labels are unused once cfg is built.  This patch makes us
remove those dead labels (we still keep user labels even if they are not
referenced, for debug info).  This saves some peak memory, and the
optimization passes that traverse all statements are a bit faster, as
they do not need to skip the labels.

Additionally, the patch makes cfgexpand avoid creating new tree labels.

A few changes to code that did not handle empty blocks
(apply_return_prediction) or blocks not starting with a label
(rewrite_use_nonlinear_expr, vect_create_epilog_for_reduction)
were necessary.

The timings for combine.i compilation (-O2, with checking enabled)
without and with the patch:

 TOTAL                 :  25.42             0.57            26.00 43480 kB
 TOTAL                 :  24.48             0.43            25.21 42528 kB

Compilation of preprocessed gcc sources (-O2, checking disabled) is
faster by about 2-3% with the patch, on all architectures where I tested
it.  Bootstrapped & regtested on i686, x86_64, ia64 and ppc64-linux.

This is ok.


Thanks,
Richard.

Zdenek

        * tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Use
        bsi_after_labels.  Always insert statements before bsi.
        * tree-vect-transform.c (vect_create_epilog_for_reduction): Ditto.
        * predict.c (apply_return_prediction): Check for empty blocks.
        * cfgexpand.c (lab_rtx_for_bb): New variable.
        (label_rtx_for_bb): Do not create new tree labels.
        (expand_gimple_basic_block): Add labels recorded in lab_rtx_for_bb.
        (tree_expand_cfg): Initialize lab_rtx_for_bb.
        * tree-cfg.c (build_tree_cfg): Call cleanup_dead_labels after
        creating edges.
        (label_for_bb): Add field used.
        (update_eh_label, main_block_label): Mark the label used.
        (cleanup_dead_labels): Remove unused labels.


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