This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Removal of dead labels
- From: "Richard Guenther" <richard dot guenther at gmail 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: Tue, 1 May 2007 16:53:42 +0200
- Subject: Re: [patch] Removal of dead labels
- References: <20070430223035.GA18268@atrey.karlin.mff.cuni.cz> <84fc9c000704301543j2917cdc6n4599119e35e9565d@mail.gmail.com>
On 5/1/07, Richard Guenther <richard.guenther@gmail.com> wrote:
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.
I'm going to apply
+ 2007-05-01 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-loop-manip.c (ip_normal_pos): Check if last stmt
+ is NULL.
to fix an ICE for gcc.c-torture/execute/20011008-3.c -Os
Richard.
Index: ChangeLog
===================================================================
*** ChangeLog (revision 124328)
--- ChangeLog (working copy)
***************
*** 1,3 ****
--- 1,8 ----
+ 2007-05-01 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-loop-manip.c (ip_normal_pos): Check if last stmt
+ is NULL.
+
2007-05-01 Joseph Myers <joseph@codesourcery.com>
* config/rs6000/libgcc-ppc-glibc.ver (__gcc_qgt): Fix typo.
Index: tree-ssa-loop-manip.c
===================================================================
*** tree-ssa-loop-manip.c (revision 124328)
--- tree-ssa-loop-manip.c (working copy)
*************** ip_normal_pos (struct loop *loop)
*** 505,511 ****
bb = single_pred (loop->latch);
last = last_stmt (bb);
! if (TREE_CODE (last) != COND_EXPR)
return NULL;
exit = EDGE_SUCC (bb, 0);
--- 505,512 ----
bb = single_pred (loop->latch);
last = last_stmt (bb);
! if (!last
! || TREE_CODE (last) != COND_EXPR)
return NULL;
exit = EDGE_SUCC (bb, 0);