With the hybrid stmt detection no longer working as a gate-keeper
to detect unhandled stmts we have to, and can, detect those earlier.
The appropriate place is vect_mark_stmts_to_be_vectorized where
for trivially relevant PHIs we can stop analyzing when the PHI
wasn't classified as a known def during vect_analyze_scalar_cycles.
PR tree-optimization/121509
* tree-vect-stmts.cc (vect_mark_stmts_to_be_vectorized):
Fail early when we detect a relevant but not handled PHI.
* gcc.dg/vect/pr121509.c: New testcase.
--- /dev/null
+/* { dg-additional-options "-fgimple" } */
+
+#include "tree-vect.h"
+
+long g_73[2] = {6L,6L};
+int __GIMPLE (ssa,startwith("loop")) __attribute__((noipa))
+foo ()
+{
+ signed char g;
+ int l;
+ int _1;
+ unsigned char _3;
+ unsigned char _4;
+
+ __BB(2):
+ goto __BB3;
+
+ __BB(3,loop_header(1)):
+ l_5 = __PHI (__BB2: _Literal (int) -511973466, __BB3: 1);
+ g_6 = __PHI (__BB2: _Literal (signed char) 0, __BB3: g_12);
+ _1 = (int) g_6;
+ g_73[_1] = 0l;
+ _3 = (unsigned char) g_6;
+ _4 = _3 + _Literal (unsigned char) 1;
+ g_12 = (signed char) _4;
+ if (g_12 > _Literal (signed char) 1)
+ goto __BB4;
+ else
+ goto __BB3;
+
+ __BB(4):
+ l_14 = __PHI (__BB3: l_5);
+ return l_14;
+}
+
+int main()
+{
+ check_vect ();
+ if (foo () != 1)
+ abort ();
+ return 0;
+}
phi_info->stmt);
if (vect_stmt_relevant_p (phi_info, loop_vinfo, &relevant, &live_p))
- vect_mark_relevant (&worklist, phi_info, relevant, live_p);
+ {
+ if (STMT_VINFO_DEF_TYPE (phi_info) == vect_unknown_def_type)
+ return opt_result::failure_at
+ (*si, "not vectorized: unhandled relevant PHI: %G", *si);
+ vect_mark_relevant (&worklist, phi_info, relevant, live_p);
+ }
}
for (si = gsi_after_labels (bb); !gsi_end_p (si); gsi_next (&si))
{