[PATCH] Remove LIM all_refs_in_loop bitmaps

Richard Biener rguenther@suse.de
Fri Mar 22 12:15:00 GMT 2013


This removes the all_refs_in_loop bitmaps.  They add a O(loop-depth)
memory cost to the refs_in_loop bitmaps.  It removes the last
user, a query that is used to avoid walking subloops.  But that
query is costly compared to just walking the subloops.

No observable memory usage difference for PR39326, but
LIM compile-time improves by 10%.

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

Richard.

2013-03-22  Richard Biener  <rguenther@suse.de>

	* tree-ssa-loop-im.c (memory_references): Drop all_refs_in_loop.
	(gather_mem_refs_in_loops): Do not compute it.
	(analyze_memory_references): Do not allocate it.
	(tree_ssa_lim_finalize): Do not free it.
	(for_all_locs_in_loop): Do not query all_refs_in_loop.

Index: gcc/tree-ssa-loop-im.c
===================================================================
*** gcc/tree-ssa-loop-im.c	(revision 196956)
--- gcc/tree-ssa-loop-im.c	(working copy)
*************** static struct
*** 164,173 ****
    /* The set of memory references stored in each loop.  */
    vec<bitmap> refs_stored_in_loop;
  
-   /* The set of memory references accessed in each loop, including
-      subloops.  */
-   vec<bitmap> all_refs_in_loop;
- 
    /* The set of memory references stored in each loop, including subloops .  */
    vec<bitmap> all_refs_stored_in_loop;
  
--- 164,169 ----
*************** gather_mem_refs_in_loops (void)
*** 1649,1656 ****
    FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
      {
        /* Finalize the overall touched references (including subloops).  */
-       bitmap_ior_into (memory_accesses.all_refs_in_loop[loop->num],
- 		       memory_accesses.refs_in_loop[loop->num]);
        bitmap_ior_into (memory_accesses.all_refs_stored_in_loop[loop->num],
  		       memory_accesses.refs_stored_in_loop[loop->num]);
  
--- 1645,1650 ----
*************** gather_mem_refs_in_loops (void)
*** 1660,1667 ****
        if (outer == current_loops->tree_root)
  	continue;
  
-       bitmap_ior_into (memory_accesses.all_refs_in_loop[outer->num],
- 		       memory_accesses.all_refs_in_loop[loop->num]);
        bitmap_ior_into (memory_accesses.all_refs_stored_in_loop[outer->num],
  		       memory_accesses.all_refs_stored_in_loop[loop->num]);
      }
--- 1654,1659 ----
*************** analyze_memory_references (void)
*** 1683,1689 ****
  
    memory_accesses.refs_in_loop.create (number_of_loops ());
    memory_accesses.refs_stored_in_loop.create (number_of_loops ());
-   memory_accesses.all_refs_in_loop.create (number_of_loops ());
    memory_accesses.all_refs_stored_in_loop.create (number_of_loops ());
  
    for (i = 0; i < number_of_loops (); i++)
--- 1675,1680 ----
*************** analyze_memory_references (void)
*** 1693,1700 ****
        empty = BITMAP_ALLOC (&lim_bitmap_obstack);
        memory_accesses.refs_stored_in_loop.quick_push (empty);
        empty = BITMAP_ALLOC (&lim_bitmap_obstack);
-       memory_accesses.all_refs_in_loop.quick_push (empty);
-       empty = BITMAP_ALLOC (&lim_bitmap_obstack);
        memory_accesses.all_refs_stored_in_loop.quick_push (empty);
      }
  
--- 1684,1689 ----
*************** for_all_locs_in_loop (struct loop *loop,
*** 1749,1760 ****
  {
    unsigned i;
    mem_ref_loc_p loc;
-   bitmap refs = memory_accesses.all_refs_in_loop[loop->num];
    struct loop *subloop;
  
-   if (!bitmap_bit_p (refs, ref->id))
-     return false;
- 
    if (ref->accesses_in_loop.length () > (unsigned) loop->num)
      FOR_EACH_VEC_ELT (ref->accesses_in_loop[loop->num], i, loc)
        if (fn (loc))
--- 1738,1745 ----
*************** tree_ssa_lim_finalize (void)
*** 2630,2636 ****
  
    memory_accesses.refs_in_loop.release ();
    memory_accesses.refs_stored_in_loop.release ();
-   memory_accesses.all_refs_in_loop.release ();
    memory_accesses.all_refs_stored_in_loop.release ();
  
    if (memory_accesses.ttae_cache)
--- 2615,2620 ----



More information about the Gcc-patches mailing list