From: Richard Biener Date: Fri, 21 Jul 2017 11:32:39 +0000 (+0000) Subject: re PR tree-optimization/81303 (410.bwaves regression caused by r249919) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d629ab44961886947b9ba07b8f26240868904457;p=gcc.git re PR tree-optimization/81303 (410.bwaves regression caused by r249919) 2017-07-21 Richard Biener PR tree-optimization/81303 * tree-vect-data-refs.c (vect_get_peeling_costs_all_drs): Pass in datarefs vector. Allow NULL dr0 for no peeling cost estimate. (vect_peeling_hash_get_lowest_cost): Adjust. (vect_enhance_data_refs_alignment): Likewise. Use vect_get_peeling_costs_all_drs to compute the penalty for no peeling to match up costs. From-SVN: r250424 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 59d59b815e0..96f89f4eb76 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,14 @@ -2017-06-21 Richard Biener +2017-07-21 Richard Biener + + PR tree-optimization/81303 + * tree-vect-data-refs.c (vect_get_peeling_costs_all_drs): Pass + in datarefs vector. Allow NULL dr0 for no peeling cost estimate. + (vect_peeling_hash_get_lowest_cost): Adjust. + (vect_enhance_data_refs_alignment): Likewise. Use + vect_get_peeling_costs_all_drs to compute the penalty for no + peeling to match up costs. + +2017-07-21 Richard Biener PR tree-optimization/81500 * tree-vect-loop.c (vect_is_simple_reduction): Properly fail if diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 8b55d5948ea..177729006e8 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -1159,25 +1159,21 @@ vect_peeling_hash_get_most_frequent (_vect_peel_info **slot, misalignment will be zero after peeling. */ static void -vect_get_peeling_costs_all_drs (struct data_reference *dr0, +vect_get_peeling_costs_all_drs (vec datarefs, + struct data_reference *dr0, unsigned int *inside_cost, unsigned int *outside_cost, stmt_vector_for_cost *body_cost_vec, unsigned int npeel, bool unknown_misalignment) { - gimple *stmt = DR_STMT (dr0); - stmt_vec_info stmt_info = vinfo_for_stmt (stmt); - loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info); - vec datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); - unsigned i; data_reference *dr; FOR_EACH_VEC_ELT (datarefs, i, dr) { - stmt = DR_STMT (dr); - stmt_info = vinfo_for_stmt (stmt); + gimple *stmt = DR_STMT (dr); + stmt_vec_info stmt_info = vinfo_for_stmt (stmt); /* For interleaving, only the alignment of the first access matters. */ if (STMT_VINFO_GROUPED_ACCESS (stmt_info) @@ -1192,7 +1188,9 @@ vect_get_peeling_costs_all_drs (struct data_reference *dr0, int save_misalignment; save_misalignment = DR_MISALIGNMENT (dr); - if (unknown_misalignment && dr == dr0) + if (npeel == 0) + ; + else if (unknown_misalignment && dr == dr0) SET_DR_MISALIGNMENT (dr, 0); else vect_update_misalignment_for_peel (dr, dr0, npeel); @@ -1222,7 +1220,8 @@ vect_peeling_hash_get_lowest_cost (_vect_peel_info **slot, body_cost_vec.create (2); epilogue_cost_vec.create (2); - vect_get_peeling_costs_all_drs (elem->dr, &inside_cost, &outside_cost, + 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.release (); @@ -1651,7 +1650,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) stmt_vector_for_cost dummy; dummy.create (2); - vect_get_peeling_costs_all_drs (dr0, + vect_get_peeling_costs_all_drs (datarefs, dr0, &load_inside_cost, &load_outside_cost, &dummy, vf / 2, true); @@ -1660,7 +1659,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) if (first_store) { dummy.create (2); - vect_get_peeling_costs_all_drs (first_store, + vect_get_peeling_costs_all_drs (datarefs, first_store, &store_inside_cost, &store_outside_cost, &dummy, vf / 2, true); @@ -1744,18 +1743,15 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) dr0 = unsupportable_dr; else if (do_peeling) { - /* Calculate the penalty for no peeling, i.e. leaving everything - unaligned. - TODO: Adapt vect_get_peeling_costs_all_drs and use here. + /* Calculate the penalty for no peeling, i.e. leaving everything as-is. TODO: Use nopeel_outside_cost or get rid of it? */ unsigned nopeel_inside_cost = 0; unsigned nopeel_outside_cost = 0; stmt_vector_for_cost dummy; dummy.create (2); - FOR_EACH_VEC_ELT (datarefs, i, dr) - vect_get_data_access_cost (dr, &nopeel_inside_cost, - &nopeel_outside_cost, &dummy); + vect_get_peeling_costs_all_drs (datarefs, NULL, &nopeel_inside_cost, + &nopeel_outside_cost, &dummy, 0, false); dummy.release (); /* Add epilogue costs. As we do not peel for alignment here, no prologue