http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59409
--- Comment #10 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to rguent...@suse.de from comment #9) > > > >Is that ever possible to have latch execution count < 0 > >and FIRST_NITERS == 0? It happens in x32 253.perlbmk. > > That should be impossible. > That is what I thought too. But this patch diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c index 380fd22..68c24a0 100644 --- a/gcc/tree-vect-loop-manip.c +++ b/gcc/tree-vect-loop-manip.c @@ -1273,6 +1273,17 @@ slpeel_tree_peel_loop_to_edge (struct loop *loop, pre_condition = fold_build2 (LT_EXPR, boolean_type_node, scalar_loop_iters, build_int_cst (TREE_TYPE (scalar_loop_iters), limit)); + tree first_condition = + fold_build2 (LE_EXPR, boolean_type_node, *first_niters, + build_int_cst (TREE_TYPE (*first_niters), 0)); + first_condition = + fold_build2 (TRUTH_AND_EXPR, boolean_type_node, + first_condition, + fold_build2 (LT_EXPR, boolean_type_node, scalar_loop_iters, + *first_niters)); + pre_condition = + fold_build2 (TRUTH_OR_EXPR, boolean_type_node, + pre_condition, first_condition); if (cond_expr) { pre_condition = fixes the problem. But I can't explain why/how it can make a difference at all.