The following makes sure we analyze live LC PHIs not part of
a double reduction.
PR tree-optimization/121126
* tree-vect-stmts.cc (vect_analyze_stmt): Analyze the
live lane extract for LC PHIs that are vect_internal_def.
* gcc.dg/vect/pr121126.c: New testcase.
--- /dev/null
+/* { dg-additional-options "--param vect-partial-vector-usage=2" } */
+
+#include "tree-vect.h"
+
+unsigned char a;
+unsigned b;
+int r[11];
+static void __attribute__((noipa))
+c(int e, unsigned s[][11][11])
+{
+ for (int u = -(e ? 2000424973 : 0) - 2294542319; u < 7; u += 4)
+ for (int x = 0; x < 300000011; x += 4)
+ for (int y = 0; y < (0 < s[u][4][1]) + 11; y += 3) {
+ a = a ?: 1;
+ b = r[2];
+ }
+}
+long long ab;
+int e = 1;
+unsigned s[11][11][11];
+int main()
+{
+ check_vect ();
+ for (int t = 0; t < 11; ++t)
+ r[t] = 308100;
+ c(e,s);
+ ab = b;
+ if (ab != 308100)
+ __builtin_abort ();
+}
need extra handling, except for vectorizable reductions. */
if (!bb_vinfo
&& STMT_VINFO_TYPE (stmt_info) != reduc_vec_info_type
- && STMT_VINFO_TYPE (stmt_info) != lc_phi_info_type
+ && (STMT_VINFO_TYPE (stmt_info) != lc_phi_info_type
+ || STMT_VINFO_DEF_TYPE (stmt_info) == vect_internal_def)
&& (!node->ldst_lanes || SLP_TREE_CODE (node) == VEC_PERM_EXPR)
&& !can_vectorize_live_stmts (as_a <loop_vec_info> (vinfo),
node, node_instance,