This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix LIM PHI movement cost
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 18 May 2016 12:45:15 +0200 (CEST)
- Subject: [PATCH] Fix LIM PHI movement cost
- Authentication-results: sourceware.org; auth=none
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