public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix LIM PHI movement cost
@ 2016-05-18 10:45 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2016-05-18 10:45 UTC (permalink / raw)
  To: gcc-patches


The PHI movement penalty is bogously biased by adding the cost of moving
the condition - but the condition is computed unconditionally and thus
its cost should be added to the PHI cost.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

This patch is required to avoid regressing with a followup that will
exchange LIM and PRE (PRE can cleanup after LIM which avoids one
copyprop pass and it can perform CSE which increases vectorization
opportunities - failed to find the PR right now).

Richard.

2016-05-18  Richard Biener  <rguenther@suse.de>

	* tree-ssa-loop-im.c (determine_max_movement): Properly add
	condition cost to PHI cost instead of total_cost.

Index: gcc/tree-ssa-loop-im.c
===================================================================
--- gcc/tree-ssa-loop-im.c	(revision 236361)
+++ gcc/tree-ssa-loop-im.c	(working copy)
@@ -717,7 +717,7 @@ determine_max_movement (gimple *stmt, bo
 		return false;
 	      def_data = get_lim_data (SSA_NAME_DEF_STMT (val));
 	      if (def_data)
-		total_cost += def_data->cost;
+		lim_data->cost += def_data->cost;
 	    }
 
 	  /* We want to avoid unconditionally executing very expensive

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-18 10:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-18 10:45 [PATCH] Fix LIM PHI movement cost Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).