Avoids some memory allocations.

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

Richard.

2011-07-20  Richard Guenther  <rguent...@suse.de>

        * tree-ssa-structalias.c (new_var_info): Allocate oldsolution
        lazily.
        (unify_nodes): Deal with that.
        (solve_graph): Likewise.

Index: gcc/tree-ssa-structalias.c
===================================================================
*** gcc/tree-ssa-structalias.c  (revision 176497)
--- gcc/tree-ssa-structalias.c  (working copy)
*************** new_var_info (tree t, const char *name)
*** 362,368 ****
                          || (TREE_CODE (t) == VAR_DECL
                              && DECL_HARD_REGISTER (t)));
    ret->solution = BITMAP_ALLOC (&pta_obstack);
!   ret->oldsolution = BITMAP_ALLOC (&oldpta_obstack);
    ret->next = NULL;
  
    stats.total_vars++;
--- 362,368 ----
                          || (TREE_CODE (t) == VAR_DECL
                              && DECL_HARD_REGISTER (t)));
    ret->solution = BITMAP_ALLOC (&pta_obstack);
!   ret->oldsolution = NULL;
    ret->next = NULL;
  
    stats.total_vars++;
*************** unify_nodes (constraint_graph_t graph, u
*** 1504,1516 ****
        }
  
        BITMAP_FREE (get_varinfo (from)->solution);
!       BITMAP_FREE (get_varinfo (from)->oldsolution);
  
!       if (stats.iterations > 0)
!       {
!         BITMAP_FREE (get_varinfo (to)->oldsolution);
!         get_varinfo (to)->oldsolution = BITMAP_ALLOC (&oldpta_obstack);
!       }
      }
    if (valid_graph_edge (graph, to, to))
      {
--- 1504,1515 ----
        }
  
        BITMAP_FREE (get_varinfo (from)->solution);
!       if (get_varinfo (from)->oldsolution)
!       BITMAP_FREE (get_varinfo (from)->oldsolution);
  
!       if (stats.iterations > 0
!         && get_varinfo (to)->oldsolution)
!       BITMAP_FREE (get_varinfo (to)->oldsolution);
      }
    if (valid_graph_edge (graph, to, to))
      {
*************** solve_graph (constraint_graph_t graph)
*** 2544,2561 ****
              constraint_t c;
              bitmap solution;
              VEC(constraint_t,heap) *complex = graph->complex[i];
              bool solution_empty;
  
              /* Compute the changed set of solution bits.  */
!             bitmap_and_compl (pts, get_varinfo (i)->solution,
!                               get_varinfo (i)->oldsolution);
  
              if (bitmap_empty_p (pts))
                continue;
  
!             bitmap_ior_into (get_varinfo (i)->oldsolution, pts);
  
!             solution = get_varinfo (i)->solution;
              solution_empty = bitmap_empty_p (solution);
  
              /* Process the complex constraints */
--- 2543,2569 ----
              constraint_t c;
              bitmap solution;
              VEC(constraint_t,heap) *complex = graph->complex[i];
+             varinfo_t vi = get_varinfo (i);
              bool solution_empty;
  
              /* Compute the changed set of solution bits.  */
!             if (vi->oldsolution)
!               bitmap_and_compl (pts, vi->solution, vi->oldsolution);
!             else
!               bitmap_copy (pts, vi->solution);
  
              if (bitmap_empty_p (pts))
                continue;
  
!             if (vi->oldsolution)
!               bitmap_ior_into (vi->oldsolution, pts);
!             else
!               {
!                 vi->oldsolution = BITMAP_ALLOC (&oldpta_obstack);
!                 bitmap_copy (vi->oldsolution, pts);
!               }
  
!             solution = vi->solution;
              solution_empty = bitmap_empty_p (solution);
  
              /* Process the complex constraints */

Reply via email to