[PATCH] Optimize use of multi-threaded model in LIM when not needed

Richard Biener rguenther@suse.de
Fri Jun 9 10:41:00 GMT 2017


Occured to me when looking into PR81028.

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

Richard.

2017-06-09  Richard Biener  <rguenther@suse.de>

	* tree-ssa-loop-im.c (execute_sm): Do not force multi-threaded
	model if the ref is always written to.

Index: gcc/tree-ssa-loop-im.c
===================================================================
--- gcc/tree-ssa-loop-im.c	(revision 249053)
+++ gcc/tree-ssa-loop-im.c	(working copy)
@@ -198,6 +198,7 @@ static bitmap_obstack lim_bitmap_obstack
 static obstack mem_ref_obstack;
 
 static bool ref_indep_loop_p (struct loop *, im_mem_ref *, struct loop *);
+static bool ref_always_accessed_p (struct loop *, im_mem_ref *, bool);
 
 /* Minimum cost of an expensive expression.  */
 #define LIM_EXPENSIVE ((unsigned) PARAM_VALUE (PARAM_LIM_EXPENSIVE))
@@ -2025,7 +2026,8 @@ execute_sm (struct loop *loop, vec<edge>
   for_each_index (&ref->mem.ref, force_move_till, &fmt_data);
 
   if (bb_in_transaction (loop_preheader_edge (loop)->src)
-      || !PARAM_VALUE (PARAM_ALLOW_STORE_DATA_RACES))
+      || (! PARAM_VALUE (PARAM_ALLOW_STORE_DATA_RACES)
+	  && ! ref_always_accessed_p (loop, ref, true)))
     multi_threaded_model_p = true;
 
   if (multi_threaded_model_p)



More information about the Gcc-patches mailing list