diff options
author | Robin Dapp <rdapp@linux.vnet.ibm.com> | 2017-07-18 09:23:35 +0000 |
---|---|---|
committer | Andreas Krebbel <krebbel@gcc.gnu.org> | 2017-07-18 09:23:35 +0000 |
commit | ec15a152077b766a2b61c36f86172af05aa03ab5 (patch) | |
tree | be1907a923b236fb3c50be7ec8a8f85597b8f098 /gcc/tree-vect-data-refs.c | |
parent | 4169392a241995c854e72ab9ed74581bfe8c067a (diff) | |
download | gcc-ec15a152077b766a2b61c36f86172af05aa03ab5.zip gcc-ec15a152077b766a2b61c36f86172af05aa03ab5.tar.gz gcc-ec15a152077b766a2b61c36f86172af05aa03ab5.tar.bz2 |
Fix PR81362: Vector peeling
npeel was erroneously overwritten by vect_peeling_hash_get_lowest_cost
although the corresponding dataref is not used afterwards. It should
be safe to get rid of the npeel parameter since we use the returned
peeling_info's npeel anyway. Also removed the body_cost_vec parameter
which is not used elsewhere.
gcc/ChangeLog:
2017-07-18 Robin Dapp <rdapp@linux.vnet.ibm.com>
* tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Remove
body_cost_vec from _vect_peel_extended_info.
(vect_peeling_hash_get_lowest_cost): Do not set body_cost_vec.
(vect_peeling_hash_choose_best_peeling): Remove body_cost_vec and
npeel.
From-SVN: r250300
Diffstat (limited to 'gcc/tree-vect-data-refs.c')
-rw-r--r-- | gcc/tree-vect-data-refs.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 907f35e..8b55d59 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -1078,7 +1078,6 @@ typedef struct _vect_peel_extended_info struct _vect_peel_info peel_info; unsigned int inside_cost; unsigned int outside_cost; - stmt_vector_for_cost body_cost_vec; } *vect_peel_extended_info; @@ -1226,6 +1225,8 @@ vect_peeling_hash_get_lowest_cost (_vect_peel_info **slot, vect_get_peeling_costs_all_drs (elem->dr, &inside_cost, &outside_cost, &body_cost_vec, elem->npeel, false); + body_cost_vec.release (); + outside_cost += vect_get_known_peeling_cost (loop_vinfo, elem->npeel, &dummy, &LOOP_VINFO_SCALAR_ITERATION_COST (loop_vinfo), @@ -1244,14 +1245,10 @@ vect_peeling_hash_get_lowest_cost (_vect_peel_info **slot, { min->inside_cost = inside_cost; min->outside_cost = outside_cost; - min->body_cost_vec.release (); - min->body_cost_vec = body_cost_vec; min->peel_info.dr = elem->dr; min->peel_info.npeel = elem->npeel; min->peel_info.count = elem->count; } - else - body_cost_vec.release (); return 1; } @@ -1263,14 +1260,11 @@ vect_peeling_hash_get_lowest_cost (_vect_peel_info **slot, static struct _vect_peel_extended_info vect_peeling_hash_choose_best_peeling (hash_table<peel_info_hasher> *peeling_htab, - loop_vec_info loop_vinfo, - unsigned int *npeel, - stmt_vector_for_cost *body_cost_vec) + loop_vec_info loop_vinfo) { struct _vect_peel_extended_info res; res.peel_info.dr = NULL; - res.body_cost_vec = stmt_vector_for_cost (); if (!unlimited_cost_model (LOOP_VINFO_LOOP (loop_vinfo))) { @@ -1288,8 +1282,6 @@ vect_peeling_hash_choose_best_peeling (hash_table<peel_info_hasher> *peeling_hta res.outside_cost = 0; } - *npeel = res.peel_info.npeel; - *body_cost_vec = res.body_cost_vec; return res; } @@ -1454,7 +1446,6 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) unsigned possible_npeel_number = 1; tree vectype; unsigned int nelements, mis, same_align_drs_max = 0; - stmt_vector_for_cost body_cost_vec = stmt_vector_for_cost (); hash_table<peel_info_hasher> peeling_htab (1); if (dump_enabled_p ()) @@ -1729,7 +1720,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) unless aligned. So we try to choose the best possible peeling from the hash table. */ peel_for_known_alignment = vect_peeling_hash_choose_best_peeling - (&peeling_htab, loop_vinfo, &npeel, &body_cost_vec); + (&peeling_htab, loop_vinfo); } /* Compare costs of peeling for known and unknown alignment. */ @@ -1755,7 +1746,8 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) { /* Calculate the penalty for no peeling, i.e. leaving everything unaligned. - TODO: Adapt vect_get_peeling_costs_all_drs and use here. */ + TODO: Adapt vect_get_peeling_costs_all_drs and use here. + TODO: Use nopeel_outside_cost or get rid of it? */ unsigned nopeel_inside_cost = 0; unsigned nopeel_outside_cost = 0; @@ -1837,10 +1829,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) if (!stat) do_peeling = false; else - { - body_cost_vec.release (); - return stat; - } + return stat; } /* Cost model #1 - honor --param vect-max-peeling-for-alignment. */ @@ -1916,19 +1905,16 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) dump_printf_loc (MSG_NOTE, vect_location, "Peeling for alignment will be applied.\n"); } + /* The inside-loop cost will be accounted for in vectorizable_load and vectorizable_store correctly with adjusted alignments. Drop the body_cst_vec on the floor here. */ - body_cost_vec.release (); - stat = vect_verify_datarefs_alignment (loop_vinfo); gcc_assert (stat); return stat; } } - body_cost_vec.release (); - /* (2) Versioning to force alignment. */ /* Try versioning if: |