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]

[PATCH][4.4] Make referenced_vars a bitmap


With the preperational patch of introducing a global DECL_UID -> tree
mapping we can now make the per-function referenced_vars hashtable a
bitmap.  This patch does so but does not enable future optimizations
that are possible with that yet.

To ease representation changes this patch also introduces a new iterator,
FOR_EACH_REFERENCED_VAR_IN_BITMAP, which iterates over all variables
referenced in a bitmap.  This combines the current pattern

       EXECUTE_IF_SET_IN_BITMAP (STORED_SYMS (stmt), 0, i, bi)
         {
           tree sym = referenced_var (i);

to become

       FOR_EACH_REFERENCED_VAR_IN_BITMAP (STORED_SYMS (stmt), sym, ri)
         {

so we can transparently avoid referencing GCed (and thus unused) variables
that are still referenced by UID in the iterated bitmap.  This change
could also be done separately from changing the referenced_vars
representation.

Together with this patch the previous one should be memory neutral
overall (I did not yet measure this).

Additional patches on top of this could make the unexpanded_vars list
a bitmap as well, as well as getting rid of complexity in 
remove_unused_vars (which has non-neglible runtime on tramp3d).

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

FYI, as I'm sitting on this patch for quite some time now.

Richard.

2007-11-04  Richard Guenther  <rguenther@suse.de>

	* tree-flow.h (struct gimple_df): Make referenced_vars a bitmap.
	(referenced_var_iterator): Adjust.
	(FOR_EACH_REFERENCED_VAR): Adjust.
	(FOR_EACH_REFERENCED_VAR_IN_BITMAP): New iterator.
	(num_referenced_vars): Adjust.
	* tree-flow-inline.h (gimple_referenced_vars): Adjust.
	(first_referenced_var): Remove.
	(end_referenced_vars_p): Likewise.
	(next_referenced_var): Likewise.
	(referenced_var_iterator_set): New helper function.
	* tree-dfa.c (referenced_var_lookup): Adjust.
	(referenced_var_check_and_insert): Likewise.
	(remove_referenced_var): Likewise.
	* tree-ssa.c (verify_flow_insensitive_alias_info): Use
	FOR_EACH_REFERENCED_VAR_IN_BITMAP.
	(verify_call_clobbering): Likewise.
	(verify_memory_partitions): Likewise.
	(init_tree_ssa): Allocate bitmap instead of hashtable for
	referenced_vars.
	(delete_tree_ssa): Adjust.
	* tree-ssa-alias.c (mark_aliases_call_clobbered): Use
	FOR_EACH_REFERENCED_VAR_IN_BITMAP.
	(compute_tag_properties): Likewise.
	(set_initial_properties): Likewise.
	(find_partition_for): Likewise.
	(update_reference_counts): Likewise.
	(dump_may_aliases_for): Likewise.
	* tree-ssa-operands.c (add_virtual_operand): Likewise.
	(add_call_clobber_ops): Likewise.
	(add_call_read_ops): Likewise.
	(get_asm_expr_operands): Likewise.
	* tree-into-ssa.c (dump_decl_set): Likewise.
	(update_ssa): Likewise.
	* tree-sra.c (scan_function): Likewise.
	(decide_instantiations): Likewise.
	(scalarize_parms): Likewise.
	* tree-ssa-alias-warnings.c (build_reference_table): Likewise.
	(dsa_named_for): Likewise.
	* tree-ssa-structalias.c (update_alias_info): Likewise.
	(merge_smts_into): Likewise.

Index: pointer_plus/gcc/tree-dfa.c
===================================================================
*** pointer_plus.orig/gcc/tree-dfa.c	2007-11-09 11:06:59.000000000 +0100
--- pointer_plus/gcc/tree-dfa.c	2007-11-09 15:36:53.000000000 +0100
*************** find_vars_r (tree *tp, int *walk_subtree
*** 628,639 ****
  tree 
  referenced_var_lookup (unsigned int uid)
  {
!   tree h;
!   struct tree_decl_minimal in;
!   in.uid = uid;
!   h = (tree) htab_find_with_hash (gimple_referenced_vars (cfun), &in, uid);
!   gcc_assert (h || uid == 0);
!   return h;
  }
  
  /* Check if TO is in the referenced_vars hash table and insert it if not.  
--- 628,643 ----
  tree 
  referenced_var_lookup (unsigned int uid)
  {
!   tree var;
! 
!   gcc_assert (bitmap_bit_p (gimple_referenced_vars (cfun), uid));
! 
!   /* For now also assert that the variable is really referenced.
!      Otherwise callers need to deal with the result from this function
!      being NULL.  */
!   var = lookup_decl_from_uid (uid);
!   gcc_assert (var);
!   return var;
  }
  
  /* Check if TO is in the referenced_vars hash table and insert it if not.  
*************** referenced_var_lookup (unsigned int uid)
*** 642,664 ****
  bool
  referenced_var_check_and_insert (tree to)
  { 
-   tree h, *loc;
-   struct tree_decl_minimal in;
    unsigned int uid = DECL_UID (to);
  
!   in.uid = uid;
!   h = (tree) htab_find_with_hash (gimple_referenced_vars (cfun), &in, uid);
!   if (h)
!     {
!       /* DECL_UID has already been entered in the table.  Verify that it is
! 	 the same entry as TO.  See PR 27793.  */
!       gcc_assert (h == to);
!       return false;
!     }
  
-   loc = (tree *) htab_find_slot_with_hash (gimple_referenced_vars (cfun),
- 					   &in, uid, INSERT);
-   *loc = to;
    return true;
  }
  
--- 646,658 ----
  bool
  referenced_var_check_and_insert (tree to)
  { 
    unsigned int uid = DECL_UID (to);
  
!   if (bitmap_bit_p (gimple_referenced_vars (cfun), uid))
!     return false;
! 
!   bitmap_set_bit (gimple_referenced_vars (cfun), uid);
  
    return true;
  }
  
*************** void
*** 748,755 ****
  remove_referenced_var (tree var)
  {
    var_ann_t v_ann;
-   struct tree_decl_minimal in;
-   void **loc;
    unsigned int uid = DECL_UID (var);
    subvar_t sv;
  
--- 742,747 ----
*************** remove_referenced_var (tree var)
*** 769,778 ****
      ggc_free (v_ann);
    var->base.ann = NULL;
    gcc_assert (DECL_P (var));
!   in.uid = uid;
!   loc = htab_find_slot_with_hash (gimple_referenced_vars (cfun), &in, uid,
! 				  NO_INSERT);
!   htab_clear_slot (gimple_referenced_vars (cfun), loc);
  }
  
  
--- 761,767 ----
      ggc_free (v_ann);
    var->base.ann = NULL;
    gcc_assert (DECL_P (var));
!   bitmap_clear_bit (gimple_referenced_vars (cfun), uid);
  }
  
  
Index: pointer_plus/gcc/tree-flow-inline.h
===================================================================
*** pointer_plus.orig/gcc/tree-flow-inline.h	2007-11-05 18:04:53.000000000 +0100
--- pointer_plus/gcc/tree-flow-inline.h	2007-11-09 15:36:53.000000000 +0100
*************** gimple_call_clobbered_vars (const struct
*** 66,72 ****
  }
  
  /* Array of all variables referenced in the function.  */
! static inline htab_t
  gimple_referenced_vars (const struct function *fun)
  {
    if (!fun->gimple_df)
--- 66,72 ----
  }
  
  /* Array of all variables referenced in the function.  */
! static inline bitmap
  gimple_referenced_vars (const struct function *fun)
  {
    if (!fun->gimple_df)
*************** next_htab_element (htab_iterator *hti)
*** 145,178 ****
    return NULL;
  }
  
! /* Initialize ITER to point to the first referenced variable in the
!    referenced_vars hashtable, and return that variable.  */
! 
! static inline tree
! first_referenced_var (referenced_var_iterator *iter)
! {
!   return (tree) first_htab_element (&iter->hti,
! 				    gimple_referenced_vars (cfun));
! }
! 
! /* Return true if we have hit the end of the referenced variables ITER is
!    iterating through.  */
  
  static inline bool
! end_referenced_vars_p (const referenced_var_iterator *iter)
  {
!   return end_htab_p (&iter->hti);
  }
  
- /* Make ITER point to the next referenced_var in the referenced_var hashtable,
-    and return that variable.  */
- 
- static inline tree
- next_referenced_var (referenced_var_iterator *iter)
- {
-   return (tree) next_htab_element (&iter->hti);
- } 
- 
  /* Fill up VEC with the variables in the referenced vars hashtable.  */
  
  static inline void
--- 145,167 ----
    return NULL;
  }
  
! /* Helper for FOR_EACH_REFERENCED_VAR.  Needed unless iterator
!    bodies deal with NULL elements.  */
  
  static inline bool
! referenced_var_iterator_set (referenced_var_iterator *ri, tree *var)
  {
!   while (1)
!     {
!       if (!bmp_iter_set (&ri->bi, &ri->i))
! 	return false;
!       *var = lookup_decl_from_uid (ri->i);
!       if (*var)
! 	return true;
!       bmp_iter_next (&ri->bi, &ri->i);
!     }
  }
  
  /* Fill up VEC with the variables in the referenced vars hashtable.  */
  
  static inline void
Index: pointer_plus/gcc/tree-flow.h
===================================================================
*** pointer_plus.orig/gcc/tree-flow.h	2007-11-09 15:07:34.000000000 +0100
--- pointer_plus/gcc/tree-flow.h	2007-11-09 15:36:53.000000000 +0100
*************** struct mem_ref_stats_d GTY(())
*** 138,145 ****
     fields should have gimple_set accessor.  */
  struct gimple_df GTY(())
  {
!   /* Array of all variables referenced in the function.  */
!   htab_t GTY((param_is (union tree_node))) referenced_vars;
  
    /* A list of all the noreturn calls passed to modify_stmt.
       cleanup_control_flow uses it to detect cases where a mid-block
--- 138,145 ----
     fields should have gimple_set accessor.  */
  struct gimple_df GTY(())
  {
!   /* Bitmap of all variables referenced in the function.  */
!   bitmap referenced_vars;
  
    /* A list of all the noreturn calls passed to modify_stmt.
       cleanup_control_flow uses it to detect cases where a mid-block
*************** extern int int_tree_map_eq (const void *
*** 571,590 ****
  
  typedef struct 
  {
!   htab_iterator hti;
  } referenced_var_iterator;
  
- 
  /* This macro loops over all the referenced vars, one at a time, putting the
!    current var in VAR.  Note:  You are not allowed to add referenced variables
!    to the hashtable while using this macro.  Doing so may cause it to behave
!    erratically.  */
  
  #define FOR_EACH_REFERENCED_VAR(VAR, ITER) \
!   for ((VAR) = first_referenced_var (&(ITER)); \
!        !end_referenced_vars_p (&(ITER)); \
!        (VAR) = next_referenced_var (&(ITER))) 
! 
  
  typedef struct
  {
--- 571,597 ----
  
  typedef struct 
  {
!   bitmap_iterator bi;
!   unsigned int i;
  } referenced_var_iterator;
  
  /* This macro loops over all the referenced vars, one at a time, putting the
!    current var in VAR.  Note:  It is undefined whether referenced variables
!    you add or remove during the iteration show up or not.  */
  
  #define FOR_EACH_REFERENCED_VAR(VAR, ITER) \
!   for (bmp_iter_set_init (&(ITER).bi, gimple_referenced_vars (cfun), 0, &(ITER).i); \
!        referenced_var_iterator_set (&(ITER), &(VAR)); \
!        bmp_iter_next (&(ITER).bi, &(ITER).i))
! 
! /* Iterate over all variables whose UID is set in the bitmap BM, putting the
!    current var in VAR.  Note: It is undefined whether variables you add or
!    remove during the iteration show up or not.  */
! 
! #define FOR_EACH_REFERENCED_VAR_IN_BITMAP(BM, VAR, ITER) \
!   for (bmp_iter_set_init (&(ITER).bi, (BM), 0, &(ITER).i); \
!        referenced_var_iterator_set (&(ITER), &(VAR)); \
!        bmp_iter_next (&(ITER).bi, &(ITER).i))
  
  typedef struct
  {
*************** typedef struct
*** 606,612 ****
  
  extern tree referenced_var_lookup (unsigned int);
  extern bool referenced_var_check_and_insert (tree);
! #define num_referenced_vars htab_elements (gimple_referenced_vars (cfun))
  #define referenced_var(i) referenced_var_lookup (i)
  
  #define num_ssa_names (VEC_length (tree, cfun->gimple_df->ssa_names))
--- 613,619 ----
  
  extern tree referenced_var_lookup (unsigned int);
  extern bool referenced_var_check_and_insert (tree);
! #define num_referenced_vars bitmap_count_bits (gimple_referenced_vars (cfun))
  #define referenced_var(i) referenced_var_lookup (i)
  
  #define num_ssa_names (VEC_length (tree, cfun->gimple_df->ssa_names))
Index: pointer_plus/gcc/tree-ssa.c
===================================================================
*** pointer_plus.orig/gcc/tree-ssa.c	2007-11-09 15:07:34.000000000 +0100
--- pointer_plus/gcc/tree-ssa.c	2007-11-09 15:36:53.000000000 +0100
*************** verify_flow_insensitive_alias_info (void
*** 378,405 ****
  
    FOR_EACH_REFERENCED_VAR (var, rvi)
      {
-       unsigned int j;
        bitmap aliases;
        tree alias;
!       bitmap_iterator bi;
  
        if (!MTAG_P (var) || !MTAG_ALIASES (var))
  	continue;
        
        aliases = MTAG_ALIASES (var);
  
!       EXECUTE_IF_SET_IN_BITMAP (aliases, 0, j, bi)
! 	{
! 	  alias = referenced_var (j);
! 
! 	  if (TREE_CODE (alias) != MEMORY_PARTITION_TAG
! 	      && !may_be_aliased (alias))
! 	    {
! 	      error ("non-addressable variable inside an alias set");
! 	      debug_variable (alias);
! 	      goto err;
! 	    }
! 	}
      }
  
    return;
--- 378,400 ----
  
    FOR_EACH_REFERENCED_VAR (var, rvi)
      {
        bitmap aliases;
        tree alias;
!       referenced_var_iterator ri;
  
        if (!MTAG_P (var) || !MTAG_ALIASES (var))
  	continue;
        
        aliases = MTAG_ALIASES (var);
  
!       FOR_EACH_REFERENCED_VAR_IN_BITMAP (aliases, alias, ri)
! 	if (TREE_CODE (alias) != MEMORY_PARTITION_TAG
! 	    && !may_be_aliased (alias))
! 	  {
! 	    error ("non-addressable variable inside an alias set");
! 	    debug_variable (alias);
! 	    goto err;
! 	  }
      }
  
    return;
*************** err:
*** 486,505 ****
  static void
  verify_call_clobbering (void)
  {
-   unsigned int i;
-   bitmap_iterator bi;
-   tree var;
    referenced_var_iterator rvi;
  
    /* At all times, the result of the call_clobbered flag should
       match the result of the call_clobbered_vars bitmap.  Verify both
       that everything in call_clobbered_vars is marked
       call_clobbered, and that everything marked
       call_clobbered is in call_clobbered_vars.  */
!   EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, i, bi)
      {
-       var = referenced_var (i);
- 
        if (memory_partition (var))
  	var = memory_partition (var);
  
--- 481,497 ----
  static void
  verify_call_clobbering (void)
  {
    referenced_var_iterator rvi;
+   tree var;
  
    /* At all times, the result of the call_clobbered flag should
       match the result of the call_clobbered_vars bitmap.  Verify both
       that everything in call_clobbered_vars is marked
       call_clobbered, and that everything marked
       call_clobbered is in call_clobbered_vars.  */
!   FOR_EACH_REFERENCED_VAR_IN_BITMAP (gimple_call_clobbered_vars (cfun),
! 				     var, rvi)
      {
        if (memory_partition (var))
  	var = memory_partition (var);
  
*************** verify_memory_partitions (void)
*** 550,557 ****
  
    for (i = 0; VEC_iterate (tree, mpt_table, i, mpt); i++)
      {
!       unsigned j;
!       bitmap_iterator bj;
  
        if (MPT_SYMBOLS (mpt) == NULL)
  	{
--- 542,549 ----
  
    for (i = 0; VEC_iterate (tree, mpt_table, i, mpt); i++)
      {
!       referenced_var_iterator ri;
!       tree var;
  
        if (MPT_SYMBOLS (mpt) == NULL)
  	{
*************** verify_memory_partitions (void)
*** 560,576 ****
  	  goto err;
  	}
  
!       EXECUTE_IF_SET_IN_BITMAP (MPT_SYMBOLS (mpt), 0, j, bj)
! 	{
! 	  tree var = referenced_var (j);
! 	  if (pointer_set_insert (partitioned_syms, var))
! 	    {
! 	      error ("Partitioned symbols should belong to exactly one "
! 		     "partition");
! 	      debug_variable (var);
! 	      goto err;
! 	    }
! 	}
      }
  
    pointer_set_destroy (partitioned_syms);
--- 552,565 ----
  	  goto err;
  	}
  
!       FOR_EACH_REFERENCED_VAR_IN_BITMAP (MPT_SYMBOLS (mpt), var, ri)
! 	if (pointer_set_insert (partitioned_syms, var))
! 	  {
! 	    error ("Partitioned symbols should belong to exactly one "
! 		   "partition");
! 	    debug_variable (var);
! 	    goto err;
! 	  }
      }
  
    pointer_set_destroy (partitioned_syms);
*************** void
*** 817,824 ****
  init_tree_ssa (void)
  {
    cfun->gimple_df = GGC_CNEW (struct gimple_df);
!   cfun->gimple_df->referenced_vars = htab_create_ggc (20, uid_decl_map_hash, 
! 				     		      uid_decl_map_eq, NULL);
    cfun->gimple_df->default_defs = htab_create_ggc (20, uid_ssaname_map_hash, 
  				                   uid_ssaname_map_eq, NULL);
    cfun->gimple_df->var_anns = htab_create_ggc (20, var_ann_hash, 
--- 806,812 ----
  init_tree_ssa (void)
  {
    cfun->gimple_df = GGC_CNEW (struct gimple_df);
!   cfun->gimple_df->referenced_vars = BITMAP_GGC_ALLOC ();
    cfun->gimple_df->default_defs = htab_create_ggc (20, uid_ssaname_map_hash, 
  				                   uid_ssaname_map_eq, NULL);
    cfun->gimple_df->var_anns = htab_create_ggc (20, var_ann_hash, 
*************** delete_tree_ssa (void)
*** 875,881 ****
          ggc_free (var->base.ann);
        var->base.ann = NULL;
      }
-   htab_delete (gimple_referenced_vars (cfun));
    cfun->gimple_df->referenced_vars = NULL;
  
    fini_ssanames ();
--- 863,868 ----
Index: pointer_plus/gcc/tree-ssa-alias.c
===================================================================
*** pointer_plus.orig/gcc/tree-ssa-alias.c	2007-11-09 14:11:17.000000000 +0100
--- pointer_plus/gcc/tree-ssa-alias.c	2007-11-09 15:36:53.000000000 +0100
*************** mark_aliases_call_clobbered (tree tag, V
*** 390,397 ****
  			     bitmap on_worklist, bitmap queued)
  {
    bitmap aliases;
!   bitmap_iterator bi;
!   unsigned int i;
    tree entry;
    var_ann_t ta = var_ann (tag);
  
--- 390,396 ----
  			     bitmap on_worklist, bitmap queued)
  {
    bitmap aliases;
!   referenced_var_iterator ri;
    tree entry;
    var_ann_t ta = var_ann (tag);
  
*************** mark_aliases_call_clobbered (tree tag, V
*** 401,409 ****
    if (!aliases)
      return;
  
!   EXECUTE_IF_SET_IN_BITMAP (aliases, 0, i, bi)
      {
-       entry = referenced_var (i);
        /* If you clobber one part of a structure, you
  	 clobber the entire thing.  While this does not make
  	 the world a particularly nice place, it is necessary
--- 400,407 ----
    if (!aliases)
      return;
  
!   FOR_EACH_REFERENCED_VAR_IN_BITMAP (aliases, entry, ri)
      {
        /* If you clobber one part of a structure, you
  	 clobber the entire thing.  While this does not make
  	 the world a particularly nice place, it is necessary
*************** mark_aliases_call_clobbered (tree tag, V
*** 420,428 ****
      }
    if (!bitmap_empty_p (queued))
      {
!       EXECUTE_IF_SET_IN_BITMAP (queued, 0, i, bi)
  	{
! 	  subvar_t svars = get_subvars_for_var (referenced_var (i));
  	  unsigned int i;
  	  tree subvar;
  
--- 418,426 ----
      }
    if (!bitmap_empty_p (queued))
      {
!       FOR_EACH_REFERENCED_VAR_IN_BITMAP (queued, entry, ri)
  	{
! 	  subvar_t svars = get_subvars_for_var (entry);
  	  unsigned int i;
  	  tree subvar;
  
*************** compute_tag_properties (void)
*** 484,491 ****
        for (k = 0; VEC_iterate (tree, taglist, k, tag); k++)
  	{
  	  bitmap ma;
! 	  bitmap_iterator bi;
! 	  unsigned int i;
  	  tree entry;
  	  bool tagcc = is_call_clobbered (tag);
  	  bool tagglobal = MTAG_GLOBAL (tag);
--- 482,488 ----
        for (k = 0; VEC_iterate (tree, taglist, k, tag); k++)
  	{
  	  bitmap ma;
! 	  referenced_var_iterator ri;
  	  tree entry;
  	  bool tagcc = is_call_clobbered (tag);
  	  bool tagglobal = MTAG_GLOBAL (tag);
*************** compute_tag_properties (void)
*** 497,505 ****
  	  if (!ma)
  	    continue;
  
! 	  EXECUTE_IF_SET_IN_BITMAP (ma, 0, i, bi)
  	    {
- 	      entry = referenced_var (i);
  	      /* Call clobbered entries cause the tag to be marked
  		 call clobbered.  */
  	      if (!tagcc && is_call_clobbered (entry))
--- 494,501 ----
  	  if (!ma)
  	    continue;
  
! 	  FOR_EACH_REFERENCED_VAR_IN_BITMAP (ma, entry, ri)
  	    {
  	      /* Call clobbered entries cause the tag to be marked
  		 call clobbered.  */
  	      if (!tagcc && is_call_clobbered (entry))
*************** set_initial_properties (struct alias_inf
*** 581,592 ****
  
  	  if (pi->pt_vars)
  	    {
! 	      bitmap_iterator bi;
! 	      unsigned int j;	      
! 	      EXECUTE_IF_SET_IN_BITMAP (pi->pt_vars, 0, j, bi)
  		{
- 		  tree alias = referenced_var (j);
- 
  		  /* If you clobber one part of a structure, you
  		     clobber the entire thing.  While this does not make
  		     the world a particularly nice place, it is necessary
--- 577,586 ----
  
  	  if (pi->pt_vars)
  	    {
! 	      referenced_var_iterator ri;
! 	      tree alias;
! 	      FOR_EACH_REFERENCED_VAR_IN_BITMAP (pi->pt_vars, alias, ri)
  		{
  		  /* If you clobber one part of a structure, you
  		     clobber the entire thing.  While this does not make
  		     the world a particularly nice place, it is necessary
*************** set_initial_properties (struct alias_inf
*** 600,608 ****
  	      /* Process variables we need to clobber all parts of.  */
  	      if (!bitmap_empty_p (queued))
  		{
! 		  EXECUTE_IF_SET_IN_BITMAP (queued, 0, j, bi)
  		    {
! 		      subvar_t svars = get_subvars_for_var (referenced_var (j));
  		      unsigned int i;
  		      tree subvar;
  
--- 594,602 ----
  	      /* Process variables we need to clobber all parts of.  */
  	      if (!bitmap_empty_p (queued))
  		{
! 		  FOR_EACH_REFERENCED_VAR_IN_BITMAP (queued, alias, ri)
  		    {
! 		      subvar_t svars = get_subvars_for_var (alias);
  		      unsigned int i;
  		      tree subvar;
  
*************** find_partition_for (mem_sym_stats_t mp_p
*** 1181,1193 ****
  static void
  rewrite_alias_set_for (tree tag, bitmap new_aliases)
  {
!   bitmap_iterator bi;
!   unsigned i;
    tree mpt, sym;
  
!   EXECUTE_IF_SET_IN_BITMAP (MTAG_ALIASES (tag), 0, i, bi)
      {
-       sym = referenced_var (i);
        mpt = memory_partition (sym);
        if (mpt)
  	bitmap_set_bit (new_aliases, DECL_UID (mpt));
--- 1175,1185 ----
  static void
  rewrite_alias_set_for (tree tag, bitmap new_aliases)
  {
!   referenced_var_iterator ri;
    tree mpt, sym;
  
!   FOR_EACH_REFERENCED_VAR_IN_BITMAP (MTAG_ALIASES (tag), sym, ri)
      {
        mpt = memory_partition (sym);
        if (mpt)
  	bitmap_set_bit (new_aliases, DECL_UID (mpt));
*************** estimate_vop_reduction (struct mem_ref_s
*** 1298,1306 ****
  static void
  update_reference_counts (struct mem_ref_stats_d *mem_ref_stats)
  {
!   unsigned i;
!   bitmap_iterator bi;
    mem_sym_stats_t sym_stats;
  
    for (i = 1; i < num_ssa_names; i++)
      {
--- 1290,1299 ----
  static void
  update_reference_counts (struct mem_ref_stats_d *mem_ref_stats)
  {
!   referenced_var_iterator ri;
    mem_sym_stats_t sym_stats;
+   unsigned int i;
+   tree sym;
  
    for (i = 1; i < num_ssa_names; i++)
      {
*************** update_reference_counts (struct mem_ref_
*** 1313,1321 ****
  	  && (pi = SSA_NAME_PTR_INFO (ptr)) != NULL
  	  && pi->is_dereferenced)
  	{
! 	  unsigned j;
! 	  bitmap_iterator bj;
! 	  tree tag;
  	  mem_sym_stats_t ptr_stats, tag_stats;
  
  	  /* If PTR has flow-sensitive points-to information, use
--- 1306,1312 ----
  	  && (pi = SSA_NAME_PTR_INFO (ptr)) != NULL
  	  && pi->is_dereferenced)
  	{
! 	  tree tag, alias;
  	  mem_sym_stats_t ptr_stats, tag_stats;
  
  	  /* If PTR has flow-sensitive points-to information, use
*************** update_reference_counts (struct mem_ref_
*** 1341,1349 ****
  	     TAG's alias set, add as many indirect references to ALIAS
  	     as direct references there are for TAG.  */
  	  if (MTAG_ALIASES (tag))
! 	    EXECUTE_IF_SET_IN_BITMAP (MTAG_ALIASES (tag), 0, j, bj)
  	      {
- 		tree alias = referenced_var (j);
  		sym_stats = get_mem_sym_stats_for (alias);
  
  		/* All the direct references to TAG are indirect references
--- 1332,1339 ----
  	     TAG's alias set, add as many indirect references to ALIAS
  	     as direct references there are for TAG.  */
  	  if (MTAG_ALIASES (tag))
! 	    FOR_EACH_REFERENCED_VAR_IN_BITMAP (MTAG_ALIASES (tag), alias, ri)
  	      {
  		sym_stats = get_mem_sym_stats_for (alias);
  
  		/* All the direct references to TAG are indirect references
*************** update_reference_counts (struct mem_ref_
*** 1363,1371 ****
  
    /* Call-clobbered symbols are indirectly written at every
       call/asm site.  */
!   EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, i, bi)
      {
-       tree sym = referenced_var (i);
        sym_stats = get_mem_sym_stats_for (sym);
        sym_stats->num_indirect_writes += mem_ref_stats->num_call_sites
  	                                + mem_ref_stats->num_asm_sites;
--- 1353,1360 ----
  
    /* Call-clobbered symbols are indirectly written at every
       call/asm site.  */
!   FOR_EACH_REFERENCED_VAR_IN_BITMAP (gimple_call_clobbered_vars (cfun), sym, ri)
      {
        sym_stats = get_mem_sym_stats_for (sym);
        sym_stats->num_indirect_writes += mem_ref_stats->num_call_sites
  	                                + mem_ref_stats->num_asm_sites;
*************** update_reference_counts (struct mem_ref_
*** 1374,1382 ****
    /* Addressable symbols are indirectly written at some ASM sites.
       Since only ASM sites that clobber memory actually affect
       addressable symbols, this is an over-estimation.  */
!   EXECUTE_IF_SET_IN_BITMAP (gimple_addressable_vars (cfun), 0, i, bi)
      {
-       tree sym = referenced_var (i);
        sym_stats = get_mem_sym_stats_for (sym);
        sym_stats->num_indirect_writes += mem_ref_stats->num_asm_sites;
      }
--- 1363,1370 ----
    /* Addressable symbols are indirectly written at some ASM sites.
       Since only ASM sites that clobber memory actually affect
       addressable symbols, this is an over-estimation.  */
!   FOR_EACH_REFERENCED_VAR_IN_BITMAP (gimple_addressable_vars (cfun), sym, ri)
      {
        sym_stats = get_mem_sym_stats_for (sym);
        sym_stats->num_indirect_writes += mem_ref_stats->num_asm_sites;
      }
*************** dump_may_aliases_for (FILE *file, tree v
*** 3466,3479 ****
    aliases = MTAG_ALIASES (var);
    if (aliases)
      {
!       bitmap_iterator bi;
!       unsigned int i;
        tree al;
  
        fprintf (file, "{ ");
!       EXECUTE_IF_SET_IN_BITMAP (aliases, 0, i, bi)
  	{
- 	  al = referenced_var (i);
  	  print_generic_expr (file, al, dump_flags);
  	  fprintf (file, " ");
  	}
--- 3454,3465 ----
    aliases = MTAG_ALIASES (var);
    if (aliases)
      {
!       referenced_var_iterator ri;
        tree al;
  
        fprintf (file, "{ ");
!       FOR_EACH_REFERENCED_VAR_IN_BITMAP (aliases, al, ri)
  	{
  	  print_generic_expr (file, al, dump_flags);
  	  fprintf (file, " ");
  	}
Index: pointer_plus/gcc/tree-ssa-operands.c
===================================================================
*** pointer_plus.orig/gcc/tree-ssa-operands.c	2007-11-09 11:06:59.000000000 +0100
--- pointer_plus/gcc/tree-ssa-operands.c	2007-11-09 15:36:53.000000000 +0100
*************** add_virtual_operand (tree var, stmt_ann_
*** 1525,1542 ****
      }
    else
      {
!       bitmap_iterator bi;
!       unsigned int i;
        bool none_added = true;
        
        /* The variable is aliased.  Add its aliases to the virtual
  	 operands.  */
        gcc_assert (!bitmap_empty_p (aliases));
  
!       EXECUTE_IF_SET_IN_BITMAP (aliases, 0, i, bi)
  	{
- 	  tree al = referenced_var (i);
- 
  	  /* For SFTs we have to consider all subvariables of the parent var
  	     if it is a potential points-to location.  */
  	  if (TREE_CODE (al) == STRUCT_FIELD_TAG
--- 1525,1540 ----
      }
    else
      {
!       referenced_var_iterator ri;
        bool none_added = true;
+       tree al;
        
        /* The variable is aliased.  Add its aliases to the virtual
  	 operands.  */
        gcc_assert (!bitmap_empty_p (aliases));
  
!       FOR_EACH_REFERENCED_VAR_IN_BITMAP (aliases, al, ri)
  	{
  	  /* For SFTs we have to consider all subvariables of the parent var
  	     if it is a potential points-to location.  */
  	  if (TREE_CODE (al) == STRUCT_FIELD_TAG
*************** static void
*** 1794,1802 ****
  add_call_clobber_ops (tree stmt, tree callee)
  {
    unsigned u;
!   bitmap_iterator bi;
    stmt_ann_t s_ann = stmt_ann (stmt);
    bitmap not_read_b, not_written_b;
    
    /* If we created .GLOBAL_VAR earlier, just use it.  */
    if (gimple_global_var (cfun))
--- 1792,1801 ----
  add_call_clobber_ops (tree stmt, tree callee)
  {
    unsigned u;
!   referenced_var_iterator ri;
    stmt_ann_t s_ann = stmt_ann (stmt);
    bitmap not_read_b, not_written_b;
+   tree var;
    
    /* If we created .GLOBAL_VAR earlier, just use it.  */
    if (gimple_global_var (cfun))
*************** add_call_clobber_ops (tree stmt, tree ca
*** 1810,1826 ****
       set for each static if the call being processed does not read
       or write that variable.  */
    not_read_b = callee ? ipa_reference_get_not_read_global (callee) : NULL; 
!   not_written_b = callee ? ipa_reference_get_not_written_global (callee) : NULL; 
  
    /* Add a VDEF operand for every call clobbered variable.  */
!   EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, u, bi)
      {
!       tree var = referenced_var_lookup (u);
!       unsigned int escape_mask = var_ann (var)->escape_mask;
        tree real_var = var;
        bool not_read;
        bool not_written;
!       
        /* Not read and not written are computed on regular vars, not
  	 subvars, so look at the parent var if this is an SFT. */
        if (TREE_CODE (var) == STRUCT_FIELD_TAG)
--- 1809,1826 ----
       set for each static if the call being processed does not read
       or write that variable.  */
    not_read_b = callee ? ipa_reference_get_not_read_global (callee) : NULL; 
!   not_written_b = callee ? ipa_reference_get_not_written_global (callee) : NULL;
  
    /* Add a VDEF operand for every call clobbered variable.  */
!   FOR_EACH_REFERENCED_VAR_IN_BITMAP (gimple_call_clobbered_vars (cfun), var, ri)
      {
!       unsigned int escape_mask;
        tree real_var = var;
        bool not_read;
        bool not_written;
! 
!       escape_mask = var_ann (var)->escape_mask;
! 
        /* Not read and not written are computed on regular vars, not
  	 subvars, so look at the parent var if this is an SFT. */
        if (TREE_CODE (var) == STRUCT_FIELD_TAG)
*************** add_call_clobber_ops (tree stmt, tree ca
*** 1877,1886 ****
  static void
  add_call_read_ops (tree stmt, tree callee)
  {
!   unsigned u;
!   bitmap_iterator bi;
    stmt_ann_t s_ann = stmt_ann (stmt);
    bitmap not_read_b;
  
    /* if the function is not pure, it may reference memory.  Add
       a VUSE for .GLOBAL_VAR if it has been created.  See add_referenced_var
--- 1877,1886 ----
  static void
  add_call_read_ops (tree stmt, tree callee)
  {
!   referenced_var_iterator ri;
    stmt_ann_t s_ann = stmt_ann (stmt);
    bitmap not_read_b;
+   tree var;
  
    /* if the function is not pure, it may reference memory.  Add
       a VUSE for .GLOBAL_VAR if it has been created.  See add_referenced_var
*************** add_call_read_ops (tree stmt, tree calle
*** 1895,1906 ****
    not_read_b = callee ? ipa_reference_get_not_read_global (callee) : NULL; 
  
    /* Add a VUSE for each call-clobbered variable.  */
!   EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, u, bi)
      {
-       tree var = referenced_var (u);
        tree real_var = var;
        bool not_read;
!       
        clobber_stats.readonly_clobbers++;
  
        /* Not read and not written are computed on regular vars, not
--- 1895,1905 ----
    not_read_b = callee ? ipa_reference_get_not_read_global (callee) : NULL; 
  
    /* Add a VUSE for each call-clobbered variable.  */
!   FOR_EACH_REFERENCED_VAR_IN_BITMAP (gimple_call_clobbered_vars (cfun), var, ri)
      {
        tree real_var = var;
        bool not_read;
! 
        clobber_stats.readonly_clobbers++;
  
        /* Not read and not written are computed on regular vars, not
*************** get_asm_expr_operands (tree stmt)
*** 2022,2042 ****
    for (link = ASM_CLOBBERS (stmt); link; link = TREE_CHAIN (link))
      if (strcmp (TREE_STRING_POINTER (TREE_VALUE (link)), "memory") == 0)
        {
! 	unsigned i;
! 	bitmap_iterator bi;
  
  	s_ann->references_memory = true;
  
! 	EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, i, bi)
! 	  {
! 	    tree var = referenced_var (i);
! 	    add_stmt_operand (&var, s_ann, opf_def | opf_implicit);
! 	  }
  
! 	EXECUTE_IF_SET_IN_BITMAP (gimple_addressable_vars (cfun), 0, i, bi)
  	  {
- 	    tree var = referenced_var (i);
- 
  	    /* Subvars are explicitly represented in this list, so we
  	       don't need the original to be added to the clobber ops,
  	       but the original *will* be in this list because we keep
--- 2021,2038 ----
    for (link = ASM_CLOBBERS (stmt); link; link = TREE_CHAIN (link))
      if (strcmp (TREE_STRING_POINTER (TREE_VALUE (link)), "memory") == 0)
        {
! 	referenced_var_iterator ri;
! 	tree var;
  
  	s_ann->references_memory = true;
  
! 	FOR_EACH_REFERENCED_VAR_IN_BITMAP (gimple_call_clobbered_vars (cfun),
! 					   var, ri)
! 	  add_stmt_operand (&var, s_ann, opf_def | opf_implicit);
  
! 	FOR_EACH_REFERENCED_VAR_IN_BITMAP (gimple_addressable_vars (cfun),
! 					   var, ri)
  	  {
  	    /* Subvars are explicitly represented in this list, so we
  	       don't need the original to be added to the clobber ops,
  	       but the original *will* be in this list because we keep
Index: pointer_plus/gcc/tree-into-ssa.c
===================================================================
*** pointer_plus.orig/gcc/tree-into-ssa.c	2007-11-09 15:36:41.000000000 +0100
--- pointer_plus/gcc/tree-into-ssa.c	2007-11-09 15:36:53.000000000 +0100
*************** dump_decl_set (FILE *file, bitmap set)
*** 1463,1476 ****
  {
    if (set)
      {
!       bitmap_iterator bi;
!       unsigned i;
  
        fprintf (file, "{ ");
  
!       EXECUTE_IF_SET_IN_BITMAP (set, 0, i, bi)
  	{
! 	  print_generic_expr (file, referenced_var (i), 0);
  	  fprintf (file, " ");
  	}
  
--- 1463,1476 ----
  {
    if (set)
      {
!       referenced_var_iterator ri;
!       tree var;
  
        fprintf (file, "{ ");
  
!       FOR_EACH_REFERENCED_VAR_IN_BITMAP (set, var, ri)
  	{
! 	  print_generic_expr (file, var, 0);
  	  fprintf (file, " ");
  	}
  
*************** update_ssa (unsigned update_flags)
*** 3201,3212 ****
       memory symbols into the set MEM_SYMS_TO_RENAME.  */
    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))
  	    bitmap_set_bit (regs_to_rename, i);
  	  else
--- 3201,3211 ----
       memory symbols into the set MEM_SYMS_TO_RENAME.  */
    if (!bitmap_empty_p (syms_to_rename))
      {
!       referenced_var_iterator ri;
!       tree sym;
  
!       FOR_EACH_REFERENCED_VAR_IN_BITMAP (syms_to_rename, sym, ri)
  	{
  	  if (is_gimple_reg (sym))
  	    bitmap_set_bit (regs_to_rename, i);
  	  else
Index: pointer_plus/gcc/tree-sra.c
===================================================================
*** pointer_plus.orig/gcc/tree-sra.c	2007-10-18 11:44:51.000000000 +0200
--- pointer_plus/gcc/tree-sra.c	2007-11-09 15:36:53.000000000 +0100
*************** scan_function (void)
*** 1162,1179 ****
    static const struct sra_walk_fns fns = {
      scan_use, scan_copy, scan_init, scan_ldst, true
    };
-   bitmap_iterator bi;
  
    sra_walk_function (&fns);
  
    if (dump_file && (dump_flags & TDF_DETAILS))
      {
!       unsigned i;
  
        fputs ("\nScan results:\n", dump_file);
!       EXECUTE_IF_SET_IN_BITMAP (sra_candidates, 0, i, bi)
  	{
- 	  tree var = referenced_var (i);
  	  struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
  	  if (elt)
  	    scan_dump (elt);
--- 1162,1178 ----
    static const struct sra_walk_fns fns = {
      scan_use, scan_copy, scan_init, scan_ldst, true
    };
  
    sra_walk_function (&fns);
  
    if (dump_file && (dump_flags & TDF_DETAILS))
      {
!       referenced_var_iterator ri;
!       tree var;
  
        fputs ("\nScan results:\n", dump_file);
!       FOR_EACH_REFERENCED_VAR_IN_BITMAP (sra_candidates, var, ri)
  	{
  	  struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
  	  if (elt)
  	    scan_dump (elt);
*************** decide_block_copy (struct sra_elt *elt)
*** 1950,1968 ****
  static void
  decide_instantiations (void)
  {
-   unsigned int i;
    bool cleared_any;
    bitmap_head done_head;
!   bitmap_iterator bi;
  
    /* We cannot clear bits from a bitmap we're iterating over,
       so save up all the bits to clear until the end.  */
    bitmap_initialize (&done_head, &bitmap_default_obstack);
    cleared_any = false;
  
!   EXECUTE_IF_SET_IN_BITMAP (sra_candidates, 0, i, bi)
      {
-       tree var = referenced_var (i);
        struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
        if (elt)
  	{
--- 1949,1966 ----
  static void
  decide_instantiations (void)
  {
    bool cleared_any;
    bitmap_head done_head;
!   referenced_var_iterator ri;
!   tree var;
  
    /* We cannot clear bits from a bitmap we're iterating over,
       so save up all the bits to clear until the end.  */
    bitmap_initialize (&done_head, &bitmap_default_obstack);
    cleared_any = false;
  
!   FOR_EACH_REFERENCED_VAR_IN_BITMAP (sra_candidates, var, ri)
      {
        struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
        if (elt)
  	{
*************** decide_instantiations (void)
*** 1972,1978 ****
  	}
        if (!elt)
  	{
! 	  bitmap_set_bit (&done_head, i);
  	  cleared_any = true;
  	}
      }
--- 1970,1976 ----
  	}
        if (!elt)
  	{
! 	  bitmap_set_bit (&done_head, DECL_UID (var));
  	  cleared_any = true;
  	}
      }
*************** static void
*** 3501,3512 ****
  scalarize_parms (void)
  {
    tree list = NULL;
!   unsigned i;
!   bitmap_iterator bi;
  
!   EXECUTE_IF_SET_IN_BITMAP (needs_copy_in, 0, i, bi)
      {
-       tree var = referenced_var (i);
        struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
        generate_copy_inout (elt, true, var, &list);
      }
--- 3499,3509 ----
  scalarize_parms (void)
  {
    tree list = NULL;
!   referenced_var_iterator ri;
!   tree var;
  
!   FOR_EACH_REFERENCED_VAR_IN_BITMAP (needs_copy_in, var, ri)
      {
        struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
        generate_copy_inout (elt, true, var, &list);
      }
Index: pointer_plus/gcc/tree-ssa-alias-warnings.c
===================================================================
*** pointer_plus.orig/gcc/tree-ssa-alias-warnings.c	2007-11-05 18:04:53.000000000 +0100
--- pointer_plus/gcc/tree-ssa-alias-warnings.c	2007-11-09 15:36:53.000000000 +0100
*************** build_reference_table (void)
*** 452,465 ****
  	  /* Add all aliased names to the interesting reference list.  */
  	  if (pi->pt_vars)
  	    {
! 	      unsigned ix;
! 	      bitmap_iterator bi;
  
! 	      EXECUTE_IF_SET_IN_BITMAP (pi->pt_vars, 0, ix, bi)
! 		{
! 		  tree alias = referenced_var (ix);
! 		  add_key (ref_table->objs, alias, references_pool);
! 		}
  	    }
  	}
      }
--- 452,462 ----
  	  /* Add all aliased names to the interesting reference list.  */
  	  if (pi->pt_vars)
  	    {
! 	      referenced_var_iterator ri;
! 	      tree alias;
  
! 	      FOR_EACH_REFERENCED_VAR_IN_BITMAP (pi->pt_vars, alias, ri)
! 		add_key (ref_table->objs, alias, references_pool);
  	    }
  	}
      }
*************** dsa_named_for (tree ptr)
*** 914,930 ****
        /* For all the variables it could be aliased to.  */
        if (pi->pt_vars)
  	{
! 	  unsigned ix;
! 	  bitmap_iterator bi;
  
! 	  EXECUTE_IF_SET_IN_BITMAP (pi->pt_vars, 0, ix, bi)
! 	    {
! 	      tree alias = referenced_var (ix);
! 
! 	      if (nonstandard_alias_p (ptr, alias, false))
! 		strict_aliasing_warn (SSA_NAME_DEF_STMT (ptr),
! 				      ptr, true, alias, false, true);
! 	    }
  	}
      }
  }
--- 911,923 ----
        /* For all the variables it could be aliased to.  */
        if (pi->pt_vars)
  	{
! 	  referenced_var_iterator ri;
! 	  tree alias;
  
! 	  FOR_EACH_REFERENCED_VAR_IN_BITMAP (pi->pt_vars, alias, ri)
! 	    if (nonstandard_alias_p (ptr, alias, false))
! 	      strict_aliasing_warn (SSA_NAME_DEF_STMT (ptr),
! 				    ptr, true, alias, false, true);
  	}
      }
  }
Index: pointer_plus/gcc/tree-ssa-structalias.c
===================================================================
*** pointer_plus.orig/gcc/tree-ssa-structalias.c	2007-11-09 11:06:59.000000000 +0100
--- pointer_plus/gcc/tree-ssa-structalias.c	2007-11-09 15:36:53.000000000 +0100
*************** update_alias_info (tree stmt, struct ali
*** 3322,3333 ****
  	 call-clobbered.  */
        if (stmt_escape_type != NO_ESCAPE)
  	{
! 	  bitmap_iterator bi;
! 	  unsigned i;
  
! 	  EXECUTE_IF_SET_IN_BITMAP (addr_taken, 0, i, bi)
  	    {
- 	      tree rvar = referenced_var (i);
  	      if (!unmodifiable_var_p (rvar))
  		mark_call_clobbered (rvar, stmt_escape_type);
  	    }
--- 3322,3332 ----
  	 call-clobbered.  */
        if (stmt_escape_type != NO_ESCAPE)
  	{
! 	  referenced_var_iterator ri;
! 	  tree rvar;
  
! 	  FOR_EACH_REFERENCED_VAR_IN_BITMAP (addr_taken, rvar, ri)
  	    {
  	      if (!unmodifiable_var_p (rvar))
  		mark_call_clobbered (rvar, stmt_escape_type);
  	    }
*************** update_alias_info (tree stmt, struct ali
*** 3485,3492 ****
       memory reference stats for all memory symbols referenced by STMT.  */
    if (stmt_references_memory_p (stmt))
      {
!       unsigned i;
!       bitmap_iterator bi;
  
        mem_ref_stats->num_mem_stmts++;
  
--- 3484,3491 ----
       memory reference stats for all memory symbols referenced by STMT.  */
    if (stmt_references_memory_p (stmt))
      {
!       referenced_var_iterator ri;
!       tree sym;
  
        mem_ref_stats->num_mem_stmts++;
  
*************** update_alias_info (tree stmt, struct ali
*** 3513,3521 ****
  	 memory symbols in its argument list, but these cases do not
  	 occur so frequently as to constitute a serious problem.  */
        if (STORED_SYMS (stmt))
! 	EXECUTE_IF_SET_IN_BITMAP (STORED_SYMS (stmt), 0, i, bi)
  	  {
- 	    tree sym = referenced_var (i);
  	    pointer_set_insert (ai->written_vars, sym);
  	    if (!stmt_dereferences_ptr_p
  		&& stmt_escape_type != ESCAPE_TO_CALL
--- 3512,3519 ----
  	 memory symbols in its argument list, but these cases do not
  	 occur so frequently as to constitute a serious problem.  */
        if (STORED_SYMS (stmt))
! 	FOR_EACH_REFERENCED_VAR_IN_BITMAP (STORED_SYMS (stmt), sym, ri)
  	  {
  	    pointer_set_insert (ai->written_vars, sym);
  	    if (!stmt_dereferences_ptr_p
  		&& stmt_escape_type != ESCAPE_TO_CALL
*************** update_alias_info (tree stmt, struct ali
*** 3529,3536 ****
  	  && stmt_escape_type != ESCAPE_TO_CALL
  	  && stmt_escape_type != ESCAPE_TO_PURE_CONST
  	  && stmt_escape_type != ESCAPE_TO_ASM)
! 	EXECUTE_IF_SET_IN_BITMAP (LOADED_SYMS (stmt), 0, i, bi)
! 	  update_mem_sym_stats_from_stmt (referenced_var (i), stmt, 1, 0);
      }
  }
  
--- 3527,3534 ----
  	  && stmt_escape_type != ESCAPE_TO_CALL
  	  && stmt_escape_type != ESCAPE_TO_PURE_CONST
  	  && stmt_escape_type != ESCAPE_TO_ASM)
! 	FOR_EACH_REFERENCED_VAR_IN_BITMAP (LOADED_SYMS (stmt), sym, ri)
! 	  update_mem_sym_stats_from_stmt (sym, stmt, 1, 0);
      }
  }
  
*************** set_used_smts (void)
*** 4852,4859 ****
  static void
  merge_smts_into (tree p, bitmap solution)
  {
-   unsigned int i;
-   bitmap_iterator bi;
    tree smt;
    bitmap aliases;
    tree var = p;
--- 4850,4855 ----
*************** merge_smts_into (tree p, bitmap solution
*** 4865,4882 ****
    if (smt)
      {
        alias_set_type smtset = get_alias_set (TREE_TYPE (smt));
  
        /* Need to set the SMT subsets first before this
  	 will work properly.  */
        bitmap_set_bit (solution, DECL_UID (smt));
!       EXECUTE_IF_SET_IN_BITMAP (used_smts, 0, i, bi)
  	{
- 	  tree newsmt = referenced_var (i);
  	  tree newsmttype = TREE_TYPE (newsmt);
  
  	  if (alias_set_subset_of (get_alias_set (newsmttype),
  				   smtset))
! 	    bitmap_set_bit (solution, i);
  	}
  
        aliases = MTAG_ALIASES (smt);
--- 4861,4879 ----
    if (smt)
      {
        alias_set_type smtset = get_alias_set (TREE_TYPE (smt));
+       referenced_var_iterator ri;
+       tree newsmt;
  
        /* Need to set the SMT subsets first before this
  	 will work properly.  */
        bitmap_set_bit (solution, DECL_UID (smt));
!       FOR_EACH_REFERENCED_VAR_IN_BITMAP (used_smts, newsmt, ri)
  	{
  	  tree newsmttype = TREE_TYPE (newsmt);
  
  	  if (alias_set_subset_of (get_alias_set (newsmttype),
  				   smtset))
! 	    bitmap_set_bit (solution, DECL_UID (newsmt));
  	}
  
        aliases = MTAG_ALIASES (smt);


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