This merges the tri-state caches (not computed, dependent, independent) bitmaps to improve cache locality.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Queued for 4.9. Richard. 2013-03-12 Richard Biener <rguent...@suse.de> * tree-ssa-loop-im.c (struct mem_ref): Merge indep_loop and dep_loop into loop_dependence, merge indep_ref and dep_ref into ref_dependence. (mem_ref_alloc): Adjust. (refs_independent_p): Likewise. (record_indep_loop): Likewise. (ref_indep_loop_p): Likewise. Index: trunk/gcc/tree-ssa-loop-im.c =================================================================== *** trunk.orig/gcc/tree-ssa-loop-im.c 2013-03-12 14:18:44.000000000 +0100 --- trunk/gcc/tree-ssa-loop-im.c 2013-03-12 14:27:37.054487784 +0100 *************** typedef struct mem_ref *** 127,147 **** /* The locations of the accesses. Vector indexed by the loop number. */ ! /* The following sets are computed on demand. We keep both set and ! its complement, so that we know whether the information was ! already computed or not. */ ! bitmap indep_loop; /* The set of loops in that the memory ! reference is independent, meaning: ! If it is stored in the loop, this store ! is independent on all other loads and ! stores. ! If it is only loaded, then it is independent ! on all stores in the loop. */ ! bitmap dep_loop; /* The complement of INDEP_LOOP. */ ! ! bitmap indep_ref; /* The set of memory references on that ! this reference is independent. */ ! bitmap dep_ref; /* The complement of INDEP_REF. */ } *mem_ref_p; --- 127,145 ---- /* The locations of the accesses. Vector indexed by the loop number. */ ! /* The following sets are computed on demand. We use two bits per ! information to represent the not-computed state. */ ! ! /* The set of loops in that the memory reference is independent ! (2 * loop->num) or dependent (2 * loop->num + 1) in. ! If it is stored in the loop, this store is independent on all other ! loads and stores. ! If it is only loaded, then it is independent on all stores in the loop. */ ! bitmap loop_dependence; ! ! /* The set of memory references on that this reference is independent ! (2 * mem->id) or dependent (2 * mem->id + 1). */ ! bitmap ref_dependence; } *mem_ref_p; *************** mem_ref_alloc (tree mem, unsigned hash, *** 1481,1490 **** ref->id = id; ref->hash = hash; ref->stored = BITMAP_ALLOC (&lim_bitmap_obstack); ! ref->indep_loop = BITMAP_ALLOC (&lim_bitmap_obstack); ! ref->dep_loop = BITMAP_ALLOC (&lim_bitmap_obstack); ! ref->indep_ref = BITMAP_ALLOC (&lim_bitmap_obstack); ! ref->dep_ref = BITMAP_ALLOC (&lim_bitmap_obstack); ref->accesses_in_loop.create (0); return ref; --- 1479,1486 ---- ref->id = id; ref->hash = hash; ref->stored = BITMAP_ALLOC (&lim_bitmap_obstack); ! ref->loop_dependence = BITMAP_ALLOC (&lim_bitmap_obstack); ! ref->ref_dependence = BITMAP_ALLOC (&lim_bitmap_obstack); ref->accesses_in_loop.create (0); return ref; *************** refs_independent_p (mem_ref_p ref1, mem_ *** 2178,2186 **** ref2 = tem; } ! if (bitmap_bit_p (ref1->indep_ref, ref2->id)) return true; ! if (bitmap_bit_p (ref1->dep_ref, ref2->id)) return false; if (dump_file && (dump_flags & TDF_DETAILS)) --- 2174,2182 ---- ref2 = tem; } ! if (bitmap_bit_p (ref1->ref_dependence, 2 * ref2->id)) return true; ! if (bitmap_bit_p (ref1->ref_dependence, 2 * ref2->id + 1)) return false; if (dump_file && (dump_flags & TDF_DETAILS)) *************** refs_independent_p (mem_ref_p ref1, mem_ *** 2190,2203 **** if (mem_refs_may_alias_p (ref1->mem, ref2->mem, &memory_accesses.ttae_cache)) { ! bitmap_set_bit (ref1->dep_ref, ref2->id); if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "dependent.\n"); return false; } else { ! bitmap_set_bit (ref1->indep_ref, ref2->id); if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "independent.\n"); return true; --- 2186,2199 ---- if (mem_refs_may_alias_p (ref1->mem, ref2->mem, &memory_accesses.ttae_cache)) { ! bitmap_set_bit (ref1->ref_dependence, 2 * ref2->id + 1); if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "dependent.\n"); return false; } else { ! bitmap_set_bit (ref1->ref_dependence, 2 * ref2->id); if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "independent.\n"); return true; *************** static void *** 2211,2219 **** record_indep_loop (struct loop *loop, mem_ref_p ref, bool indep) { if (indep) ! bitmap_set_bit (ref->indep_loop, loop->num); else ! bitmap_set_bit (ref->dep_loop, loop->num); } /* Returns true if REF is independent on all other memory references in --- 2207,2215 ---- record_indep_loop (struct loop *loop, mem_ref_p ref, bool indep) { if (indep) ! bitmap_set_bit (ref->loop_dependence, 2 * loop->num); else ! bitmap_set_bit (ref->loop_dependence, 2 * loop->num + 1); } /* Returns true if REF is independent on all other memory references in *************** ref_indep_loop_p (struct loop *loop, mem *** 2256,2264 **** { bool ret; ! if (bitmap_bit_p (ref->indep_loop, loop->num)) return true; ! if (bitmap_bit_p (ref->dep_loop, loop->num)) return false; ret = ref_indep_loop_p_1 (loop, ref); --- 2252,2260 ---- { bool ret; ! if (bitmap_bit_p (ref->loop_dependence, 2 * loop->num)) return true; ! if (bitmap_bit_p (ref->loop_dependence, 2 * loop->num + 1)) return false; ret = ref_indep_loop_p_1 (loop, ref);