Reduce the number of aligned_access_p calls
authorRichard Biener <rguenther@suse.de>
Mon, 18 Oct 2021 11:54:34 +0000 (13:54 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 18 Oct 2021 13:18:03 +0000 (15:18 +0200)
This uses the computed alignment scheme in vectorizable_store
much like vectorizable_load does instead of re-querying
it via aligned_access_p.

2021-10-18  Richard Biener  <rguenther@suse.de>

* tree-vect-stmts.c (vectorizable_store): Use the
computed alignment scheme instead of querying
aligned_access_p.

gcc/tree-vect-stmts.c

index 0e5e553..07123a2 100644 (file)
@@ -8213,8 +8213,11 @@ vectorizable_store (vec_info *vinfo,
                vec_oprnd = result_chain[i];
 
              align = known_alignment (DR_TARGET_ALIGNMENT (first_dr_info));
-             if (aligned_access_p (first_dr_info, vectype))
-               misalign = 0;
+             if (alignment_support_scheme == dr_aligned)
+               {
+                 gcc_assert (aligned_access_p (first_dr_info, vectype));
+                 misalign = 0;
+               }
              else if (dr_misalignment (first_dr_info, vectype)
                       == DR_MISALIGNMENT_UNKNOWN)
                {
@@ -8299,8 +8302,8 @@ vectorizable_store (vec_info *vinfo,
                                          dataref_offset
                                          ? dataref_offset
                                          : build_int_cst (ref_type, 0));
-                 if (aligned_access_p (first_dr_info, vectype))
-                   ;
+                 if (alignment_support_scheme == dr_aligned)
+                   gcc_assert (aligned_access_p (first_dr_info, vectype));
                  else
                    TREE_TYPE (data_ref)
                      = build_aligned_type (TREE_TYPE (data_ref),