diff --git a/gcc/testsuite/gcc.dg/torture/pr99880.c b/gcc/testsuite/gcc.dg/torture/pr99880.c new file mode 100644 index 00000000000..7e0989987d7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr99880.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-ftree-vectorize" } */ + +unsigned a; +int b, c, d, e; +void f() { + b = 5; + for (; b <= 51; b++) + ; + unsigned int g = -8; + while (g) { + g += 5; + int h = 10; + do { + h -= a = 1; + for (; a; a++) + ; + c *= c >= d >= b; + } while (h); + c -= e; + } +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 38d96fc1634..4e928c65b31 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -9148,6 +9148,7 @@ maybe_set_vectorized_backedge_value (loop_vec_info loop_vinfo, if (gphi *phi = dyn_cast (USE_STMT (use_p))) if (gimple_bb (phi)->loop_father->header == gimple_bb (phi) && (phi_info = loop_vinfo->lookup_stmt (phi)) + && STMT_VINFO_RELEVANT_P (phi_info) && VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (phi_info)) && STMT_VINFO_REDUC_TYPE (phi_info) != FOLD_LEFT_REDUCTION && STMT_VINFO_REDUC_TYPE (phi_info) != EXTRACT_LAST_REDUCTION)