On Tue, 27 Nov 2012, Jakub Jelinek wrote:

> On Tue, Nov 27, 2012 at 01:00:05PM +0100, Richard Biener wrote:
> > 
> > This removes dead code as suggested by Jakub.
> > 
> > Bootstrapped and tested on x86_64-unknown-linux-gnu.
> 
> Looks as partial removal only.  IMHO
>   gimple_stmt_iterator gsinext = *gsi;
>   gimple next_stmt;
> 
>   gsi_next (&gsinext);
>   next_stmt = gsi_end_p (gsinext) ? NULL : gsi_stmt (gsinext);
> can go too and
>   /* Fold *& on the lhs.  Don't do this if stmt folded into nothing,
>      as we'd changing the next stmt.  */
>   if (gimple_has_lhs (stmt) && stmt != next_stmt)
> should be:
>   /* Fold *& on the lhs.  */
>   if (gimple_has_lhs (stmt))

Indeed - the following removes that pieces as well.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2012-12-06  Richard Biener  <rguent...@suse.de>

        * gimple-fold.c (fold_stmt_1): Remove code handling folding
        stmts away.

Index: gcc/gimple-fold.c
===================================================================
*** gcc/gimple-fold.c   (revision 194242)
--- gcc/gimple-fold.c   (working copy)
*************** fold_stmt_1 (gimple_stmt_iterator *gsi,
*** 1157,1167 ****
    bool changed = false;
    gimple stmt = gsi_stmt (*gsi);
    unsigned i;
-   gimple_stmt_iterator gsinext = *gsi;
-   gimple next_stmt;
- 
-   gsi_next (&gsinext);
-   next_stmt = gsi_end_p (gsinext) ? NULL : gsi_stmt (gsinext);
  
    /* Fold the main computation performed by the statement.  */
    switch (gimple_code (stmt))
--- 1157,1162 ----
*************** fold_stmt_1 (gimple_stmt_iterator *gsi,
*** 1284,1292 ****
  
    stmt = gsi_stmt (*gsi);
  
!   /* Fold *& on the lhs.  Don't do this if stmt folded into nothing,
!      as we'd changing the next stmt.  */
!   if (gimple_has_lhs (stmt) && stmt != next_stmt)
      {
        tree lhs = gimple_get_lhs (stmt);
        if (lhs && REFERENCE_CLASS_P (lhs))
--- 1279,1286 ----
  
    stmt = gsi_stmt (*gsi);
  
!   /* Fold *& on the lhs.  */
!   if (gimple_has_lhs (stmt))
      {
        tree lhs = gimple_get_lhs (stmt);
        if (lhs && REFERENCE_CLASS_P (lhs))

Reply via email to