https://gcc.gnu.org/g:6ae711942f345e3b6e149431e5ce4eff9162835b

commit r17-2738-g6ae711942f345e3b6e149431e5ce4eff9162835b
Author: Richard Biener <[email protected]>
Date:   Mon Jul 27 19:33:38 2026 +0200

    tree-optimization/126417 - bogus fold-left reduction check
    
    I messed up and checked the vector type instead of the reduction
    number of lanes.
    
            PR tree-optimization/126417
            * tree-vect-slp.cc (vectorizable_bb_reduc_epilogue): Check
            the total number of lanes instead of the vector type against
            the two-lane special case that doesn't need fold-left reduction
            handling.

Diff:
---
 gcc/tree-vect-slp.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index e1112077c168..8057a10ff807 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -9212,7 +9212,7 @@ vectorizable_bb_reduc_epilogue (slp_instance instance,
         be included here.  */
       || (needs_fold_left_reduction_p (TREE_TYPE (vectype), reduc_code)
          && (!instance->remain_defs.is_empty ()
-             || maybe_ne (TYPE_VECTOR_SUBPARTS (vectype), 2u))))
+             || SLP_TREE_LANES (SLP_INSTANCE_TREE (instance)) != 2)))
     {
       if (dump_enabled_p ())
        dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,

Reply via email to