[PATCH][alias-improvements] Properly privatize symbol renaming of update-ssa

Richard Guenther rguenther@suse.de
Sat Jan 31 14:13:00 GMT 2009


This more properly privatizes the symbol renaming part of update-ssa
and puts measurements in place to catch mixed function use of other
parts of update-ssa.  Basically the syms_to_rename bitmap is now part
of the per-function gimple information so you can mark symbols for
renaming of different functions without calling update-ssa inbetween.

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

Richard.

2009-01-31  Richard Guenther  <rguenther@suse.de>

	* tree-flow.h (struct gimple_df): Remove vop_needs_renaming member.
	Add syms_to_rename member.
	(SYMS_TO_RENAME): New private accessor.
	(need_ssa_update_p): Adjust prototype to take function argument.
	* tree-ssanames.c (init_ssanames): Allocate SYMS_TO_RENAME.
	* tree-into-ssa.c (syms_to_rename): Remove.
	(need_to_update_vops_p): Likewise.
	(need_to_initialize_update_ssa_p): Rename to ...
	(update_ssa_initialized_fn): ... this.  Track function we are
	initialized for.
	(symbol_marked_for_renaming): Simplify.
	(add_new_name_mapping): Do not set need_to_update_vops_p.
	(dump_currdefs): Use SYMS_TO_RENAME.
	(rewrite_update_stmt): Always walk all uses/defs.
	(dump_update_ssa): Adjust.
	(init_update_ssa): Take function argument.  Track what we are
	initialized for.
	(delete_update_ssa): Reset SYMS_TO_RENAME and update_ssa_initialized_fn.
	(create_new_def_for): Initialize for cfun, assert we are initialized
	for cfun.
	(mark_sym_for_renaming): Simplify.
	(mark_set_for_renaming): Do not initialize update-ssa.
	(need_ssa_update_p): Simplify.  Take function argument.
	(name_mappings_registered_p): Assert we ask for the correct function.
	(name_registered_for_update_p): Likewise.
	(ssa_names_to_replace): Likewise.
	(release_ssa_name_after_update_ssa): Likewise.
	(update_ssa): Likewise.  Use SYMS_TO_RENAME.
	* passes.c (execute_function_todo): Adjust.
	(execute_todo): Likewise.
	* tree-cfg.c (gimple_duplicate_sese_region): Adjust.
	(gimple_duplicate_sese_tail): Likewise.
	* tree-inline.c (tree_function_versioning): Adjust.
	* tree-ssa-loop-im.c (move_computations): Adjust.
	* tree-ssa-structalias.c (compute_may_aliases): Adjust.
	* tree-ssa.c (verify_ssa): Adjust.
	* tree-vectorizer.c (slpeel_can_duplicate_loop_p): Adjust.

Index: alias-improvements/gcc/passes.c
===================================================================
*** alias-improvements.orig/gcc/passes.c	2009-01-31 12:08:23.000000000 +0100
--- alias-improvements/gcc/passes.c	2009-01-31 12:15:54.000000000 +0100
*************** execute_function_todo (void *data)
*** 930,936 ****
  	 SSA form to become out-of-date (see PR 22037).  So, even
  	 if the parent pass had not scheduled an SSA update, we may
  	 still need to do one.  */
!       if (!(flags & TODO_update_ssa_any) && need_ssa_update_p ())
  	flags |= TODO_update_ssa;
      }
  
--- 930,936 ----
  	 SSA form to become out-of-date (see PR 22037).  So, even
  	 if the parent pass had not scheduled an SSA update, we may
  	 still need to do one.  */
!       if (!(flags & TODO_update_ssa_any) && need_ssa_update_p (cfun))
  	flags |= TODO_update_ssa;
      }
  
*************** static void
*** 1019,1025 ****
  execute_todo (unsigned int flags)
  {
  #if defined ENABLE_CHECKING
!   if (need_ssa_update_p ())
      gcc_assert (flags & TODO_update_ssa_any);
  #endif
  
--- 1019,1026 ----
  execute_todo (unsigned int flags)
  {
  #if defined ENABLE_CHECKING
!   if (cfun
!       && need_ssa_update_p (cfun))
      gcc_assert (flags & TODO_update_ssa_any);
  #endif
  
Index: alias-improvements/gcc/tree-cfg.c
===================================================================
*** alias-improvements.orig/gcc/tree-cfg.c	2009-01-31 12:08:24.000000000 +0100
--- alias-improvements/gcc/tree-cfg.c	2009-01-31 12:09:07.000000000 +0100
*************** gimple_duplicate_sese_region (edge entry
*** 5120,5126 ****
        free_region_copy = true;
      }
  
!   gcc_assert (!need_ssa_update_p ());
  
    /* Record blocks outside the region that are dominated by something
       inside.  */
--- 5120,5126 ----
        free_region_copy = true;
      }
  
!   gcc_assert (!need_ssa_update_p (cfun));
  
    /* Record blocks outside the region that are dominated by something
       inside.  */
*************** gimple_duplicate_sese_tail (edge entry A
*** 5279,5285 ****
        free_region_copy = true;
      }
  
!   gcc_assert (!need_ssa_update_p ());
  
    /* Record blocks outside the region that are dominated by something
       inside.  */
--- 5279,5285 ----
        free_region_copy = true;
      }
  
!   gcc_assert (!need_ssa_update_p (cfun));
  
    /* Record blocks outside the region that are dominated by something
       inside.  */
Index: alias-improvements/gcc/tree-flow.h
===================================================================
*** alias-improvements.orig/gcc/tree-flow.h	2009-01-31 11:42:19.000000000 +0100
--- alias-improvements/gcc/tree-flow.h	2009-01-31 12:37:41.000000000 +0100
*************** struct gimple_df GTY(())
*** 82,93 ****
       for this variable with an empty defining statement.  */
    htab_t GTY((param_is (union tree_node))) default_defs;
  
    /* True if the code is in ssa form.  */
    unsigned int in_ssa_p : 1;
  
-   /* True if the VOP needs to be renamed.  */
-   unsigned int vop_needs_renaming : 1;
- 
    struct ssa_operands ssa_operands;
  };
  
--- 82,94 ----
       for this variable with an empty defining statement.  */
    htab_t GTY((param_is (union tree_node))) default_defs;
  
+   /* Symbols whose SSA form needs to be updated or created for the first
+      time.  */
+   bitmap syms_to_rename;
+ 
    /* True if the code is in ssa form.  */
    unsigned int in_ssa_p : 1;
  
    struct ssa_operands ssa_operands;
  };
  
*************** struct gimple_df GTY(())
*** 97,102 ****
--- 98,104 ----
  #define SSANAMES(fun) (fun)->gimple_df->ssa_names
  #define MODIFIED_NORETURN_CALLS(fun) (fun)->gimple_df->modified_noreturn_calls
  #define DEFAULT_DEFS(fun) (fun)->gimple_df->default_defs
+ #define SYMS_TO_RENAME(fun) (fun)->gimple_df->syms_to_rename
  
  typedef struct
  {
*************** void update_ssa (unsigned);
*** 684,690 ****
  void delete_update_ssa (void);
  void register_new_name_mapping (tree, tree);
  tree create_new_def_for (tree, gimple, def_operand_p);
! bool need_ssa_update_p (void);
  bool name_mappings_registered_p (void);
  bool name_registered_for_update_p (tree);
  bitmap ssa_names_to_replace (void);
--- 686,692 ----
  void delete_update_ssa (void);
  void register_new_name_mapping (tree, tree);
  tree create_new_def_for (tree, gimple, def_operand_p);
! bool need_ssa_update_p (struct function *);
  bool name_mappings_registered_p (void);
  bool name_registered_for_update_p (tree);
  bitmap ssa_names_to_replace (void);
Index: alias-improvements/gcc/tree-inline.c
===================================================================
*** alias-improvements.orig/gcc/tree-inline.c	2009-01-31 12:08:24.000000000 +0100
--- alias-improvements/gcc/tree-inline.c	2009-01-31 12:09:46.000000000 +0100
*************** tree_function_versioning (tree old_decl,
*** 4364,4371 ****
        if (!update_clones)
  	{
  	  fold_cond_expr_cond ();
! 	  if (need_ssa_update_p ())
! 	    update_ssa (TODO_update_ssa);
  	}
      }
    free_dominance_info (CDI_DOMINATORS);
--- 4364,4370 ----
        if (!update_clones)
  	{
  	  fold_cond_expr_cond ();
! 	  update_ssa (TODO_update_ssa);
  	}
      }
    free_dominance_info (CDI_DOMINATORS);
Index: alias-improvements/gcc/tree-into-ssa.c
===================================================================
*** alias-improvements.orig/gcc/tree-into-ssa.c	2009-01-31 11:43:51.000000000 +0100
--- alias-improvements/gcc/tree-into-ssa.c	2009-01-31 13:31:54.000000000 +0100
*************** static sbitmap old_ssa_names;
*** 113,122 ****
  static sbitmap new_ssa_names;
  
  
- /* Symbols whose SSA form needs to be updated or created for the first
-    time.  */
- static bitmap syms_to_rename;
- 
  /* Subset of SYMS_TO_RENAME.  Contains all the GIMPLE register symbols
     that have been marked for renaming.  */
  static bitmap regs_to_rename;
--- 113,118 ----
*************** struct repl_map_d
*** 155,166 ****
     then REPL_TBL[N_i] = { O_1, O_2, ..., O_j }.  */
  static htab_t repl_tbl;
  
! /* true if register_new_name_mapping needs to initialize the data
!    structures needed by update_ssa.  */
! static bool need_to_initialize_update_ssa_p = true;
! 
! /* true if update_ssa needs to update virtual operands.  */
! static bool need_to_update_vops_p = false;
  
  /* Statistics kept by update_ssa to use in the virtual mapping
     heuristic.  If the number of virtual mappings is beyond certain
--- 151,159 ----
     then REPL_TBL[N_i] = { O_1, O_2, ..., O_j }.  */
  static htab_t repl_tbl;
  
! /* The function the SSA updating data structures have been initialized for.
!    NULL if they need to be initialized by register_new_name_mapping.  */
! static struct function *update_ssa_initialized_fn = NULL;
  
  /* Statistics kept by update_ssa to use in the virtual mapping
     heuristic.  If the number of virtual mappings is beyond certain
*************** set_livein_block (tree var, basic_block 
*** 585,598 ****
  static inline bool
  symbol_marked_for_renaming (tree sym)
  {
!   if (sym == gimple_vop (cfun)
!       && cfun->gimple_df->vop_needs_renaming)
!     return true;
! 
!   if (!syms_to_rename)
!     return false;
! 
!   return bitmap_bit_p (syms_to_rename, DECL_UID (sym));
  }
  
  
--- 578,584 ----
  static inline bool
  symbol_marked_for_renaming (tree sym)
  {
!   return bitmap_bit_p (SYMS_TO_RENAME (cfun), DECL_UID (sym));
  }
  
  
*************** add_new_name_mapping (tree new_tree, tre
*** 706,713 ****
      {
        tree sym;
  
-       need_to_update_vops_p = true;
- 
        update_ssa_stats.num_virtual_mappings++;
        update_ssa_stats.num_virtual_symbols++;
  
--- 692,697 ----
*************** dump_currdefs (FILE *file)
*** 1563,1569 ****
  
    fprintf (file, "\n\nCurrent reaching definitions\n\n");
    FOR_EACH_REFERENCED_VAR (var, i)
!     if (syms_to_rename == NULL || bitmap_bit_p (syms_to_rename, DECL_UID (var)))
        {
  	fprintf (file, "CURRDEF (");
  	print_generic_expr (file, var, 0);
--- 1547,1554 ----
  
    fprintf (file, "\n\nCurrent reaching definitions\n\n");
    FOR_EACH_REFERENCED_VAR (var, i)
!     if (SYMS_TO_RENAME (cfun) == NULL
! 	|| bitmap_bit_p (SYMS_TO_RENAME (cfun), DECL_UID (var)))
        {
  	fprintf (file, "CURRDEF (");
  	print_generic_expr (file, var, 0);
*************** rewrite_update_stmt (struct dom_walk_dat
*** 1955,1981 ****
    /* Rewrite USES included in OLD_SSA_NAMES and USES whose underlying
       symbol is marked for renaming.  */
    if (rewrite_uses_p (stmt))
!     {
!       FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE)
! 	maybe_replace_use (use_p);
! 
!       if (need_to_update_vops_p
! 	  && (use_p = gimple_vuse_op (stmt)) != NULL_USE_OPERAND_P)
! 	maybe_replace_use (use_p);
!     }
  
    /* Register definitions of names in NEW_SSA_NAMES and OLD_SSA_NAMES.
       Also register definitions for names whose underlying symbol is
       marked for renaming.  */
    if (register_defs_p (stmt))
!     {
!       FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, iter, SSA_OP_DEF)
! 	maybe_register_def (def_p, stmt);
! 
!       if (need_to_update_vops_p
! 	  && (def_p = gimple_vdef_op (stmt)) != NULL_DEF_OPERAND_P)
! 	maybe_register_def (def_p, stmt);
!     }
  }
  
  
--- 1940,1954 ----
    /* Rewrite USES included in OLD_SSA_NAMES and USES whose underlying
       symbol is marked for renaming.  */
    if (rewrite_uses_p (stmt))
!     FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES)
!       maybe_replace_use (use_p);
  
    /* Register definitions of names in NEW_SSA_NAMES and OLD_SSA_NAMES.
       Also register definitions for names whose underlying symbol is
       marked for renaming.  */
    if (register_defs_p (stmt))
!     FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, iter, SSA_OP_ALL_DEFS)
!       maybe_register_def (def_p, stmt);
  }
  
  
*************** dump_update_ssa (FILE *file)
*** 2590,2596 ****
    unsigned i = 0;
    bitmap_iterator bi;
  
!   if (!need_ssa_update_p ())
      return;
  
    if (new_ssa_names && sbitmap_first_set_bit (new_ssa_names) >= 0)
--- 2563,2569 ----
    unsigned i = 0;
    bitmap_iterator bi;
  
!   if (!need_ssa_update_p (cfun))
      return;
  
    if (new_ssa_names && sbitmap_first_set_bit (new_ssa_names) >= 0)
*************** dump_update_ssa (FILE *file)
*** 2617,2631 ****
  	       update_ssa_stats.num_virtual_symbols);
      }
  
!   if (syms_to_rename && !bitmap_empty_p (syms_to_rename))
      {
        fprintf (file, "\n\nSymbols to be put in SSA form\n\n");
!       dump_decl_set (file, syms_to_rename);
!       fprintf (file, "\n");
!     }
!   if (cfun->gimple_df->vop_needs_renaming)
!     {
!       print_generic_expr (file, gimple_vop (cfun), 0);
        fprintf (file, "\n");
      }
  
--- 2590,2599 ----
  	       update_ssa_stats.num_virtual_symbols);
      }
  
!   if (!bitmap_empty_p (SYMS_TO_RENAME (cfun)))
      {
        fprintf (file, "\n\nSymbols to be put in SSA form\n\n");
!       dump_decl_set (file, SYMS_TO_RENAME (cfun));
        fprintf (file, "\n");
      }
  
*************** debug_update_ssa (void)
*** 2655,2661 ****
  /* Initialize data structures used for incremental SSA updates.  */
  
  static void
! init_update_ssa (void)
  {
    /* Reserve more space than the current number of names.  The calls to
       add_new_name_mapping are typically done after creating new SSA
--- 2623,2629 ----
  /* Initialize data structures used for incremental SSA updates.  */
  
  static void
! init_update_ssa (struct function *fn)
  {
    /* Reserve more space than the current number of names.  The calls to
       add_new_name_mapping are typically done after creating new SSA
*************** init_update_ssa (void)
*** 2667,2680 ****
    sbitmap_zero (new_ssa_names);
  
    repl_tbl = htab_create (20, repl_map_hash, repl_map_eq, repl_map_free);
-   need_to_initialize_update_ssa_p = false;
-   need_to_update_vops_p = false;
-   syms_to_rename = BITMAP_ALLOC (NULL);
    regs_to_rename = BITMAP_ALLOC (NULL);
    mem_syms_to_rename = BITMAP_ALLOC (NULL);
    names_to_release = NULL;
    memset (&update_ssa_stats, 0, sizeof (update_ssa_stats));
    update_ssa_stats.virtual_symbols = BITMAP_ALLOC (NULL);
  }
  
  
--- 2635,2646 ----
    sbitmap_zero (new_ssa_names);
  
    repl_tbl = htab_create (20, repl_map_hash, repl_map_eq, repl_map_free);
    regs_to_rename = BITMAP_ALLOC (NULL);
    mem_syms_to_rename = BITMAP_ALLOC (NULL);
    names_to_release = NULL;
    memset (&update_ssa_stats, 0, sizeof (update_ssa_stats));
    update_ssa_stats.virtual_symbols = BITMAP_ALLOC (NULL);
+   update_ssa_initialized_fn = fn;
  }
  
  
*************** delete_update_ssa (void)
*** 2686,2693 ****
    unsigned i;
    bitmap_iterator bi;
  
-   cfun->gimple_df->vop_needs_renaming = false;
- 
    sbitmap_free (old_ssa_names);
    old_ssa_names = NULL;
  
--- 2652,2657 ----
*************** delete_update_ssa (void)
*** 2697,2705 ****
    htab_delete (repl_tbl);
    repl_tbl = NULL;
  
!   need_to_initialize_update_ssa_p = true;
!   need_to_update_vops_p = false;
!   BITMAP_FREE (syms_to_rename);
    BITMAP_FREE (regs_to_rename);
    BITMAP_FREE (mem_syms_to_rename);
    BITMAP_FREE (update_ssa_stats.virtual_symbols);
--- 2661,2667 ----
    htab_delete (repl_tbl);
    repl_tbl = NULL;
  
!   bitmap_clear (SYMS_TO_RENAME (update_ssa_initialized_fn));
    BITMAP_FREE (regs_to_rename);
    BITMAP_FREE (mem_syms_to_rename);
    BITMAP_FREE (update_ssa_stats.virtual_symbols);
*************** delete_update_ssa (void)
*** 2726,2731 ****
--- 2688,2694 ----
  
    BITMAP_FREE (blocks_with_phis_to_rewrite);
    BITMAP_FREE (blocks_to_update);
+   update_ssa_initialized_fn = NULL;
  }
  
  
*************** create_new_def_for (tree old_name, gimpl
*** 2772,2783 ****
     update_ssa.  */
  
  void
! register_new_name_mapping (tree new_Tree ATTRIBUTE_UNUSED, tree old ATTRIBUTE_UNUSED)
  {
!   if (need_to_initialize_update_ssa_p)
!     init_update_ssa ();
  
!   add_new_name_mapping (new_Tree, old);
  }
  
  
--- 2735,2748 ----
     update_ssa.  */
  
  void
! register_new_name_mapping (tree new_tree, tree old)
  {
!   if (!update_ssa_initialized_fn)
!     init_update_ssa (cfun);
  
!   gcc_assert (update_ssa_initialized_fn == cfun);
! 
!   add_new_name_mapping (new_tree, old);
  }
  
  
*************** register_new_name_mapping (tree new_Tree
*** 2786,2804 ****
  void
  mark_sym_for_renaming (tree sym)
  {
!   if (sym == gimple_vop (cfun))
!     {
!       cfun->gimple_df->vop_needs_renaming = true;
!       return;
!     }
! 
!   if (need_to_initialize_update_ssa_p)
!     init_update_ssa ();
! 
!   bitmap_set_bit (syms_to_rename, DECL_UID (sym));
! 
!   if (!is_gimple_reg (sym))
!     need_to_update_vops_p = true;
  }
  
  
--- 2751,2757 ----
  void
  mark_sym_for_renaming (tree sym)
  {
!   bitmap_set_bit (SYMS_TO_RENAME (cfun), DECL_UID (sym));
  }
  
  
*************** mark_set_for_renaming (bitmap set)
*** 2813,2835 ****
    if (set == NULL || bitmap_empty_p (set))
      return;
  
-   if (need_to_initialize_update_ssa_p)
-     init_update_ssa ();
- 
    EXECUTE_IF_SET_IN_BITMAP (set, 0, i, bi)
      mark_sym_for_renaming (referenced_var (i));
  }
  
  
! /* Return true if there is any work to be done by update_ssa.  */
  
  bool
! need_ssa_update_p (void)
  {
!   return ((cfun
! 	   && cfun->gimple_df
! 	   && cfun->gimple_df->vop_needs_renaming)
! 	  || syms_to_rename || old_ssa_names || new_ssa_names);
  }
  
  /* Return true if SSA name mappings have been registered for SSA updating.  */
--- 2766,2786 ----
    if (set == NULL || bitmap_empty_p (set))
      return;
  
    EXECUTE_IF_SET_IN_BITMAP (set, 0, i, bi)
      mark_sym_for_renaming (referenced_var (i));
  }
  
  
! /* Return true if there is any work to be done by update_ssa
!    for function FN.  */
  
  bool
! need_ssa_update_p (struct function *fn)
  {
!   gcc_assert (fn != NULL);
!   return (update_ssa_initialized_fn == fn
! 	  || (fn->gimple_df
! 	      && !bitmap_empty_p (SYMS_TO_RENAME (fn))));
  }
  
  /* Return true if SSA name mappings have been registered for SSA updating.  */
*************** need_ssa_update_p (void)
*** 2837,2842 ****
--- 2788,2798 ----
  bool
  name_mappings_registered_p (void)
  {
+   if (!update_ssa_initialized_fn)
+     return false;
+ 
+   gcc_assert (update_ssa_initialized_fn == cfun);
+ 
    return repl_tbl && htab_elements (repl_tbl) > 0;
  }
  
*************** name_mappings_registered_p (void)
*** 2845,2856 ****
  bool
  name_registered_for_update_p (tree n ATTRIBUTE_UNUSED)
  {
!   if (!need_ssa_update_p ())
      return false;
  
!   return is_new_name (n)
!          || is_old_name (n)
! 	 || symbol_marked_for_renaming (SSA_NAME_VAR (n));
  }
  
  
--- 2801,2812 ----
  bool
  name_registered_for_update_p (tree n ATTRIBUTE_UNUSED)
  {
!   if (!update_ssa_initialized_fn)
      return false;
  
!   gcc_assert (update_ssa_initialized_fn == cfun);
! 
!   return is_new_name (n) || is_old_name (n);
  }
  
  
*************** ssa_names_to_replace (void)
*** 2863,2868 ****
--- 2819,2827 ----
    bitmap ret;
    sbitmap_iterator sbi;
    
+   gcc_assert (update_ssa_initialized_fn == NULL
+ 	      || update_ssa_initialized_fn == cfun);
+ 
    ret = BITMAP_ALLOC (NULL);
    EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i, sbi)
      bitmap_set_bit (ret, i);
*************** ssa_names_to_replace (void)
*** 2876,2883 ****
  void
  release_ssa_name_after_update_ssa (tree name)
  {
!   gcc_assert (!need_to_initialize_update_ssa_p
! 	      || cfun->gimple_df->vop_needs_renaming);
  
    if (names_to_release == NULL)
      names_to_release = BITMAP_ALLOC (NULL);
--- 2835,2841 ----
  void
  release_ssa_name_after_update_ssa (tree name)
  {
!   gcc_assert (cfun && update_ssa_initialized_fn == cfun);
  
    if (names_to_release == NULL)
      names_to_release = BITMAP_ALLOC (NULL);
*************** update_ssa (unsigned update_flags)
*** 3137,3152 ****
    bool insert_phi_p;
    sbitmap_iterator sbi;
  
!   if (!need_ssa_update_p ())
      return;
  
    timevar_push (TV_TREE_SSA_INCREMENTAL);
  
!   if (need_to_initialize_update_ssa_p)
!     {
!       gcc_assert (cfun->gimple_df->vop_needs_renaming);
!       init_update_ssa ();
!     }
  
    blocks_with_phis_to_rewrite = BITMAP_ALLOC (NULL);
    if (!phis_to_rewrite)
--- 3095,3108 ----
    bool insert_phi_p;
    sbitmap_iterator sbi;
  
!   if (!need_ssa_update_p (cfun))
      return;
  
    timevar_push (TV_TREE_SSA_INCREMENTAL);
  
!   if (!update_ssa_initialized_fn)
!     init_update_ssa (cfun);
!   gcc_assert (update_ssa_initialized_fn == cfun);
  
    blocks_with_phis_to_rewrite = BITMAP_ALLOC (NULL);
    if (!phis_to_rewrite)
*************** update_ssa (unsigned update_flags)
*** 3199,3216 ****
    /* If there are symbols to rename, identify those symbols that are
       GIMPLE registers into the set REGS_TO_RENAME and those that are
       memory symbols into the set MEM_SYMS_TO_RENAME.  */
!   if (cfun->gimple_df->vop_needs_renaming)
!     {
!       bitmap_set_bit (syms_to_rename, DECL_UID (gimple_vop (cfun)));
!       cfun->gimple_df->vop_needs_renaming = false;
!       need_to_update_vops_p = true;
!     }
!   if (!bitmap_empty_p (syms_to_rename))
      {
        unsigned i;
        bitmap_iterator bi;
  
!       EXECUTE_IF_SET_IN_BITMAP (syms_to_rename, 0, i, bi)
  	{
  	  tree sym = referenced_var (i);
  	  if (is_gimple_reg (sym))
--- 3155,3166 ----
    /* If there are symbols to rename, identify those symbols that are
       GIMPLE registers into the set REGS_TO_RENAME and those that are
       memory symbols into the set MEM_SYMS_TO_RENAME.  */
!   if (!bitmap_empty_p (SYMS_TO_RENAME (cfun)))
      {
        unsigned i;
        bitmap_iterator bi;
  
!       EXECUTE_IF_SET_IN_BITMAP (SYMS_TO_RENAME (cfun), 0, i, bi)
  	{
  	  tree sym = referenced_var (i);
  	  if (is_gimple_reg (sym))
*************** update_ssa (unsigned update_flags)
*** 3218,3224 ****
  	}
  
        /* Memory symbols are those not in REGS_TO_RENAME.  */
!       bitmap_and_compl (mem_syms_to_rename, syms_to_rename, regs_to_rename);
      }
  
    /* If there are names defined in the replacement table, prepare
--- 3168,3175 ----
  	}
  
        /* Memory symbols are those not in REGS_TO_RENAME.  */
!       bitmap_and_compl (mem_syms_to_rename,
! 			SYMS_TO_RENAME (cfun), regs_to_rename);
      }
  
    /* If there are names defined in the replacement table, prepare
*************** update_ssa (unsigned update_flags)
*** 3232,3243 ****
  	 removal, and there are no symbols to rename, then there's
  	 nothing else to do.  */
        if (sbitmap_first_set_bit (new_ssa_names) < 0
! 	  && bitmap_empty_p (syms_to_rename))
  	goto done;
      }
  
    /* Next, determine the block at which to start the renaming process.  */
!   if (!bitmap_empty_p (syms_to_rename))
      {
        /* If we have to rename some symbols from scratch, we need to
  	 start the process at the root of the CFG.  FIXME, it should
--- 3183,3194 ----
  	 removal, and there are no symbols to rename, then there's
  	 nothing else to do.  */
        if (sbitmap_first_set_bit (new_ssa_names) < 0
! 	  && bitmap_empty_p (SYMS_TO_RENAME (cfun)))
  	goto done;
      }
  
    /* Next, determine the block at which to start the renaming process.  */
!   if (!bitmap_empty_p (SYMS_TO_RENAME (cfun)))
      {
        /* If we have to rename some symbols from scratch, we need to
  	 start the process at the root of the CFG.  FIXME, it should
*************** update_ssa (unsigned update_flags)
*** 3291,3297 ****
  	  sbitmap_free (tmp);
  	}
  
!       EXECUTE_IF_SET_IN_BITMAP (syms_to_rename, 0, i, bi)
  	insert_updated_phi_nodes_for (referenced_var (i), dfs, blocks_to_update,
  	                              update_flags);
  
--- 3242,3248 ----
  	  sbitmap_free (tmp);
  	}
  
!       EXECUTE_IF_SET_IN_BITMAP (SYMS_TO_RENAME (cfun), 0, i, bi)
  	insert_updated_phi_nodes_for (referenced_var (i), dfs, blocks_to_update,
  	                              update_flags);
  
*************** update_ssa (unsigned update_flags)
*** 3312,3318 ****
    EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i, sbi)
      set_current_def (ssa_name (i), NULL_TREE);
  
!   EXECUTE_IF_SET_IN_BITMAP (syms_to_rename, 0, i, bi)
      set_current_def (referenced_var (i), NULL_TREE);
  
    /* Now start the renaming process at START_BB.  */
--- 3263,3269 ----
    EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i, sbi)
      set_current_def (ssa_name (i), NULL_TREE);
  
!   EXECUTE_IF_SET_IN_BITMAP (SYMS_TO_RENAME (cfun), 0, i, bi)
      set_current_def (referenced_var (i), NULL_TREE);
  
    /* Now start the renaming process at START_BB.  */
Index: alias-improvements/gcc/tree-ssa-loop-im.c
===================================================================
*** alias-improvements.orig/gcc/tree-ssa-loop-im.c	2009-01-31 12:08:24.000000000 +0100
--- alias-improvements/gcc/tree-ssa-loop-im.c	2009-01-31 12:10:17.000000000 +0100
*************** move_computations (void)
*** 1080,1086 ****
    fini_walk_dominator_tree (&walk_data);
  
    gsi_commit_edge_inserts ();
!   if (need_ssa_update_p ())
      rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
  }
  
--- 1080,1086 ----
    fini_walk_dominator_tree (&walk_data);
  
    gsi_commit_edge_inserts ();
!   if (need_ssa_update_p (cfun))
      rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
  }
  
Index: alias-improvements/gcc/tree-ssa-structalias.c
===================================================================
*** alias-improvements.orig/gcc/tree-ssa-structalias.c	2009-01-31 12:08:24.000000000 +0100
--- alias-improvements/gcc/tree-ssa-structalias.c	2009-01-31 12:10:27.000000000 +0100
*************** compute_may_aliases (void)
*** 5841,5847 ****
       points-to solution.  */
    delete_points_to_sets ();
  
!   gcc_assert (!need_ssa_update_p ());
  
    return 0;
  }
--- 5841,5847 ----
       points-to solution.  */
    delete_points_to_sets ();
  
!   gcc_assert (!need_ssa_update_p (cfun));
  
    return 0;
  }
Index: alias-improvements/gcc/tree-ssa.c
===================================================================
*** alias-improvements.orig/gcc/tree-ssa.c	2009-01-31 11:56:01.000000000 +0100
--- alias-improvements/gcc/tree-ssa.c	2009-01-31 12:10:07.000000000 +0100
*************** verify_ssa (bool check_modified_stmt)
*** 525,531 ****
    enum dom_state orig_dom_state = dom_info_state (CDI_DOMINATORS);
    bitmap names_defined_in_bb = BITMAP_ALLOC (NULL);
  
!   gcc_assert (!need_ssa_update_p ());
  
    verify_stmts ();
  
--- 525,531 ----
    enum dom_state orig_dom_state = dom_info_state (CDI_DOMINATORS);
    bitmap names_defined_in_bb = BITMAP_ALLOC (NULL);
  
!   gcc_assert (!need_ssa_update_p (cfun));
  
    verify_stmts ();
  
Index: alias-improvements/gcc/tree-ssanames.c
===================================================================
*** alias-improvements.orig/gcc/tree-ssanames.c	2009-01-31 11:56:42.000000000 +0100
--- alias-improvements/gcc/tree-ssanames.c	2009-01-31 12:44:45.000000000 +0100
*************** init_ssanames (struct function *fn, int 
*** 87,92 ****
--- 87,94 ----
       least 50 elements reserved in it.  */
    VEC_quick_push (tree, SSANAMES (fn), NULL_TREE);
    FREE_SSANAMES (fn) = NULL;
+ 
+   SYMS_TO_RENAME (fn) = BITMAP_GGC_ALLOC ();
  }
  
  /* Finalize management of SSA_NAMEs.  */
Index: alias-improvements/gcc/tree-vectorizer.c
===================================================================
*** alias-improvements.orig/gcc/tree-vectorizer.c	2009-01-31 12:08:24.000000000 +0100
--- alias-improvements/gcc/tree-vectorizer.c	2009-01-31 12:10:34.000000000 +0100
*************** slpeel_can_duplicate_loop_p (const struc
*** 973,979 ****
    gimple orig_cond = get_loop_exit_condition (loop);
    gimple_stmt_iterator loop_exit_gsi = gsi_last_bb (exit_e->src);
  
!   if (need_ssa_update_p ())
      return false;
  
    if (loop->inner
--- 973,979 ----
    gimple orig_cond = get_loop_exit_condition (loop);
    gimple_stmt_iterator loop_exit_gsi = gsi_last_bb (exit_e->src);
  
!   if (need_ssa_update_p (cfun))
      return false;
  
    if (loop->inner



More information about the Gcc-patches mailing list