This fixes the compile-time sink in find_uses_to_rename, that we
scan the whole function when nothing is to do (well, appearantly).
-O3 bootstrap and regtest on x86_64-unknown-linux-gnu in progress,
scheduled for stage1.

Richard.

2013-02-11  Richard Biener  <rguent...@suse.de>

        * tree-ssa-loop-manip.c (find_uses_to_rename): Do not scan the
        whole function when there is nothing to do.
        * tree-ssa-loop.c (pass_vectorize): Remove TODO_update_ssa.
        * tree-vectorizer.c (vectorize_loops): Update virtual and
        loop-closed SSA once.
        * tree-vect-loop.c (vect_transform_loop): Do not update SSA here.

Index: gcc/tree-ssa-loop-manip.c
===================================================================
*** gcc/tree-ssa-loop-manip.c   (revision 195940)
--- gcc/tree-ssa-loop-manip.c   (working copy)
*************** find_uses_to_rename (bitmap changed_bbs,
*** 443,463 ****
    unsigned index;
    bitmap_iterator bi;
  
!   /* ??? If CHANGED_BBS is empty we rewrite the whole function -- why?  */
!   if (changed_bbs && !bitmap_empty_p (changed_bbs))
!     {
!       EXECUTE_IF_SET_IN_BITMAP (changed_bbs, 0, index, bi)
!       {
!         find_uses_to_rename_bb (BASIC_BLOCK (index), use_blocks, need_phis);
!       }
!     }
    else
!     {
!       FOR_EACH_BB (bb)
!       {
!         find_uses_to_rename_bb (bb, use_blocks, need_phis);
!       }
!     }
  }
  
  /* Rewrites the program into a loop closed ssa form -- i.e. inserts extra
--- 443,454 ----
    unsigned index;
    bitmap_iterator bi;
  
!   if (changed_bbs)
!     EXECUTE_IF_SET_IN_BITMAP (changed_bbs, 0, index, bi)
!       find_uses_to_rename_bb (BASIC_BLOCK (index), use_blocks, need_phis);
    else
!     FOR_EACH_BB (bb)
!       find_uses_to_rename_bb (bb, use_blocks, need_phis);
  }
  
  /* Rewrites the program into a loop closed ssa form -- i.e. inserts extra
Index: gcc/tree-ssa-loop.c
===================================================================
*** gcc/tree-ssa-loop.c (revision 195940)
--- gcc/tree-ssa-loop.c (working copy)
*************** struct gimple_opt_pass pass_vectorize =
*** 242,249 ****
    0,                                    /* properties_provided */
    0,                                    /* properties_destroyed */
    0,                                  /* todo_flags_start */
!   TODO_update_ssa
!     | TODO_ggc_collect                        /* todo_flags_finish */
   }
  };
  
--- 242,248 ----
    0,                                    /* properties_provided */
    0,                                    /* properties_destroyed */
    0,                                  /* todo_flags_start */
!   TODO_ggc_collect                    /* todo_flags_finish */
   }
  };
  
Index: gcc/tree-vectorizer.c
===================================================================
*** gcc/tree-vectorizer.c       (revision 195940)
--- gcc/tree-vectorizer.c       (working copy)
*************** vectorize_loops (void)
*** 149,155 ****
  
    free_stmt_vec_info_vec ();
  
!   return num_vectorized_loops > 0 ? TODO_cleanup_cfg : 0;
  }
  
  
--- 149,164 ----
  
    free_stmt_vec_info_vec ();
  
!   if (num_vectorized_loops > 0)
!     {
!       /* If we vectorized any loop only virtual SSA form needs to be updated.
!        ???  Also while we try hard to update loop-closed SSA form we fail
!        to properly do this in some corner-cases (see PR56286).  */
!       rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa_only_virtuals);
!       return TODO_cleanup_cfg;
!     }
! 
!   return 0;
  }
  
  
Index: gcc/tree-vect-loop.c
===================================================================
*** gcc/tree-vect-loop.c        (revision 195940)
--- gcc/tree-vect-loop.c        (working copy)
*************** vect_transform_loop (loop_vec_info loop_
*** 5763,5773 ****
         loop->nb_iterations_estimate = loop->nb_iterations_estimate - 
double_int_one;
      }
  
-   /* The memory tags and pointers in vectorized statements need to
-      have their SSA forms updated.  FIXME, why can't this be delayed
-      until all the loops have been transformed?  */
-   update_ssa (TODO_update_ssa);
- 
    if (dump_enabled_p ())
      dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, "LOOP 
VECTORIZED.");
    if (loop->inner && dump_enabled_p ())
--- 5763,5768 ----

Reply via email to