[gcc r14-6683] tree-optimization/113073 - amend PR112736 fix

Richard Biener rguenth@gcc.gnu.org
Tue Dec 19 12:32:53 GMT 2023


https://gcc.gnu.org/g:aa2a48984c3d8c7a6a6da10d924e030b141b44cd

commit r14-6683-gaa2a48984c3d8c7a6a6da10d924e030b141b44cd
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Dec 19 09:58:03 2023 +0100

    tree-optimization/113073 - amend PR112736 fix
    
    The PR112736 testcase fails on RISC-V because the aligned exception
    uses the wrong check.  The alignment support scheme can be
    dr_aligned even when the access isn't aligned to the vector size
    but some targets are happy with element alignment.  The following
    fixes that.
    
            PR tree-optimization/113073
            * tree-vect-stmts.cc (vectorizable_load): Properly ensure
            to exempt only vector-size aligned overreads.

Diff:
---
 gcc/tree-vect-stmts.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index fc6923cf68a..e9ff728dfd4 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -11476,7 +11476,9 @@ vectorizable_load (vec_info *vinfo,
 				      - (group_size * vf - gap), nunits))
 			  /* DR will be unused.  */
 			  ltype = NULL_TREE;
-			else if (alignment_support_scheme == dr_aligned)
+			else if (known_ge (vect_align,
+					   tree_to_poly_uint64
+					     (TYPE_SIZE_UNIT (vectype))))
 			  /* Aligned access to excess elements is OK if
 			     at least one element is accessed in the
 			     scalar loop.  */


More information about the Gcc-cvs mailing list