public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Refine alingment peeling fix
@ 2021-09-30 11:08 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-09-30 11:08 UTC (permalink / raw)
  To: gcc-patches

This refines the previous fix further by reverting to the original
code since the API is a bit of a mess.  It also fixes the vector type
used to query the misalignment - that was what triggered the original
bogus change.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

2021-09-30  Richard Biener  <rguenther@suse.de>

	* tree-vect-data-refs.c (vect_update_misalignment_for_peel):
	Restore and fix condition under which we apply npeel to
	the DRs misalignment value.
---
 gcc/tree-vect-data-refs.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index bece58df3bf..07b5ba11f31 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -1262,10 +1262,11 @@ vect_update_misalignment_for_peel (dr_vec_info *dr_info,
     }
 
   unsigned HOST_WIDE_INT alignment;
-  tree vectype = STMT_VINFO_VECTYPE (dr_info->stmt);
   if (DR_TARGET_ALIGNMENT (dr_info).is_constant (&alignment)
-      && known_alignment_for_access_p (dr_info, vectype)
-      && npeel != 0)
+      && known_alignment_for_access_p (dr_info,
+				       STMT_VINFO_VECTYPE (dr_info->stmt))
+      && known_alignment_for_access_p (dr_peel_info,
+				       STMT_VINFO_VECTYPE (dr_peel_info->stmt)))
     {
       int misal = dr_info->misalignment;
       misal += npeel * TREE_INT_CST_LOW (DR_STEP (dr_info->dr));
@@ -1515,7 +1516,8 @@ vect_peeling_hash_get_most_frequent (_vect_peel_info **slot,
 
 /* Get the costs of peeling NPEEL iterations for LOOP_VINFO, checking
    data access costs for all data refs.  If UNKNOWN_MISALIGNMENT is true,
-   we assume DR0_INFO's misalignment will be zero after peeling.  */
+   npeel is computed at runtime but DR0_INFO's misalignment will be zero
+   after peeling.  */
 
 static void
 vect_get_peeling_costs_all_drs (loop_vec_info loop_vinfo,
-- 
2.31.1

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

only message in thread, other threads:[~2021-09-30 11:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-30 11:08 [PATCH] Refine alingment peeling fix 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).