Statements which are live but not relevant need marking to ensure they are vectorized. Live statements which are simple and all uses of them are invariant do not need to be vectorized. This patch adds a check to make sure those stmts which pass both the above checks are not vectorized and then discarded. Tested on x86 and aarch64. gcc/ *tree-vect-stmts.c (vect_stmt_relevant_p): Do not vectorize non live relevant stmts which are simple and invariant. testsuite/ * gcc.dg/vect/vect-live-slp-5.c: Remove dg check. Alan.