This makes us only consider stores instead of all references when looking for store motion opportunities.
Bootstrap pending on x86_64-unknown-linux-gnu, queued for 4.9. To be committed with omitting the gcc_checking_assert. Richard. 2013-03-12 Richard Biener <rguent...@suse.de> * tree-ssa-loop-im.c (can_sm_ref_p): Do not test whether ref is stored in the loop. (find_refs_for_sm): Walk only over all stores. Index: trunk/gcc/tree-ssa-loop-im.c =================================================================== *** trunk.orig/gcc/tree-ssa-loop-im.c 2013-03-12 13:25:30.000000000 +0100 --- trunk/gcc/tree-ssa-loop-im.c 2013-03-12 13:28:49.468824315 +0100 *************** can_sm_ref_p (struct loop *loop, mem_ref *** 2284,2291 **** return false; /* Unless the reference is stored in the loop, there is nothing to do. */ ! if (!bitmap_bit_p (ref->stored, loop->num)) ! return false; /* It should be movable. */ if (!is_gimple_reg_type (TREE_TYPE (ref->mem)) --- 2284,2290 ---- return false; /* Unless the reference is stored in the loop, there is nothing to do. */ ! gcc_checking_assert (bitmap_bit_p (ref->stored, loop->num)); /* It should be movable. */ if (!is_gimple_reg_type (TREE_TYPE (ref->mem)) *************** can_sm_ref_p (struct loop *loop, mem_ref *** 2322,2328 **** static void find_refs_for_sm (struct loop *loop, bitmap sm_executed, bitmap refs_to_sm) { ! bitmap refs = memory_accesses.all_refs_in_loop[loop->num]; unsigned i; bitmap_iterator bi; mem_ref_p ref; --- 2321,2327 ---- static void find_refs_for_sm (struct loop *loop, bitmap sm_executed, bitmap refs_to_sm) { ! bitmap refs = memory_accesses.all_refs_stored_in_loop[loop->num]; unsigned i; bitmap_iterator bi; mem_ref_p ref;