https://gcc.gnu.org/g:95f3686d4788d7420422d514996c5b6e7a8facfd

commit 95f3686d4788d7420422d514996c5b6e7a8facfd
Author: Richard Biener <rguent...@suse.de>
Date:   Thu Oct 5 14:07:02 2023 +0200

    Avoid SLP build failure for unsupported shifts
    
    When asserting that SLP _build_ can succeed we run into the SLP
    shift discovery code trying to be clever doing vectorizable_shifts
    work and failing discovery already.  That gives a false impression
    for now, so disable that when we do single-lane builds.
    
            * tree-vect-slp.cc (vect_build_slp_tree_1): Do not fail
            fatally for shifts not supported by the target when discovering
            a single lane.

Diff:
---
 gcc/tree-vect-slp.cc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 6bfc59dc2131..ecc185aae885 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -1215,7 +1215,13 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char 
*swap,
              if (!directly_supported_p (rhs_code, vectype, optab_vector))
                {
                  /* No vector/vector shift, try for a vector/scalar shift.  */
-                 if (!directly_supported_p (rhs_code, vectype, optab_scalar))
+                 if (!directly_supported_p (rhs_code, vectype, optab_scalar)
+                     /* ???  We are using this to guide operand swapping to
+                        eventually make all shift operands the same but we
+                        shouldn't fail in the end - that's be business of
+                        vectorizable_shift.
+                        Avoid spurious ICEs for single-lane discovery.  */
+                     && group_size != 1)
                    {
                      if (dump_enabled_p ())
                        dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,

Reply via email to