This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix vect_get_peeling_costs_all_drs to not record spurious final costs
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: rdapp at linux dot vnet dot ibm dot com, dje dot gcc at gmail dot com
- Date: Mon, 23 Apr 2018 14:07:21 +0200 (CEST)
- Subject: [PATCH] Fix vect_get_peeling_costs_all_drs to not record spurious final costs
The following avoids calling vect_get_load_cost with a NULL
prologue_cost_vec because that, when calling record_stmt_cost with a NULL
vector, will cause final prologue costs to be registered (redundantly).
This only affects powerpc because that is the only target with
realign-load[-optimized] support IIRC.
Bootstrap and regtest running on x86_64-unknown-linux-gnu, queued for
stage1.
Not sure if Robin is still working on GCC, David, if this has any
performance impact please report back on whether trunk should be fixed
or not. (not sure if we ever use those realign ops for power7+)
Richard.
2018-04-23 Richard Biener <rguenther@suse.de>
* tree-vect-data-refs.c (vect_get_data_access_cost): Get
prologue cost vector and pass it to vect_get_load_cost.
(vect_get_peeling_costs_all_drs): Likewise.
(vect_peeling_hash_get_lowest_cost): Likewise.
(vect_enhance_data_refs_alignment): Likewise.
Index: gcc/tree-vect-data-refs.c
===================================================================
--- gcc/tree-vect-data-refs.c (revision 259556)
+++ gcc/tree-vect-data-refs.c (working copy)
@@ -1253,7 +1254,8 @@ static void
vect_get_data_access_cost (struct data_reference *dr,
unsigned int *inside_cost,
unsigned int *outside_cost,
- stmt_vector_for_cost *body_cost_vec)
+ stmt_vector_for_cost *body_cost_vec,
+ stmt_vector_for_cost *prologue_cost_vec)
{
gimple *stmt = DR_STMT (dr);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
@@ -1267,7 +1269,7 @@ vect_get_data_access_cost (struct data_r
if (DR_IS_READ (dr))
vect_get_load_cost (dr, ncopies, true, inside_cost, outside_cost,
- NULL, body_cost_vec, false);
+ prologue_cost_vec, body_cost_vec, false);
else
vect_get_store_cost (dr, ncopies, inside_cost, body_cost_vec);
@@ -1376,6 +1378,7 @@ vect_get_peeling_costs_all_drs (vec<data
unsigned int *inside_cost,
unsigned int *outside_cost,
stmt_vector_for_cost *body_cost_vec,
+ stmt_vector_for_cost *prologue_cost_vec,
unsigned int npeel,
bool unknown_misalignment)
{
@@ -1410,7 +1413,7 @@ vect_get_peeling_costs_all_drs (vec<data
else
vect_update_misalignment_for_peel (dr, dr0, npeel);
vect_get_data_access_cost (dr, inside_cost, outside_cost,
- body_cost_vec);
+ body_cost_vec, prologue_cost_vec);
SET_DR_MISALIGNMENT (dr, save_misalignment);
}
}
@@ -1437,7 +1440,8 @@ vect_peeling_hash_get_lowest_cost (_vect
vect_get_peeling_costs_all_drs (LOOP_VINFO_DATAREFS (loop_vinfo),
elem->dr, &inside_cost, &outside_cost,
- &body_cost_vec, elem->npeel, false);
+ &body_cost_vec, &prologue_cost_vec,
+ elem->npeel, false);
body_cost_vec.release ();
@@ -1867,7 +1871,7 @@ vect_enhance_data_refs_alignment (loop_v
vect_get_peeling_costs_all_drs (datarefs, dr0,
&load_inside_cost,
&load_outside_cost,
- &dummy, estimated_npeels, true);
+ &dummy, &dummy, estimated_npeels, true);
dummy.release ();
if (first_store)
@@ -1876,7 +1880,8 @@ vect_enhance_data_refs_alignment (loop_v
vect_get_peeling_costs_all_drs (datarefs, first_store,
&store_inside_cost,
&store_outside_cost,
- &dummy, estimated_npeels, true);
+ &dummy, &dummy,
+ estimated_npeels, true);
dummy.release ();
}
else
@@ -1965,7 +1970,8 @@ vect_enhance_data_refs_alignment (loop_v
stmt_vector_for_cost dummy;
dummy.create (2);
vect_get_peeling_costs_all_drs (datarefs, NULL, &nopeel_inside_cost,
- &nopeel_outside_cost, &dummy, 0, false);
+ &nopeel_outside_cost, &dummy, &dummy,
+ 0, false);
dummy.release ();
/* Add epilogue costs. As we do not peel for alignment here, no prologue