Blob Blame History Raw
2019-01-18  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/88044
	* tree-ssa-loop-niter.c (number_of_iterations_cond): If condition
	is false in the first iteration, but !every_iteration, return false
	instead of true with niter->niter zero.

--- gcc/tree-ssa-loop-niter.c.jj	2019-01-10 11:43:02.254577008 +0100
+++ gcc/tree-ssa-loop-niter.c	2019-01-18 19:51:00.245504728 +0100
@@ -1824,6 +1824,8 @@ number_of_iterations_cond (struct loop *
   tree tem = fold_binary (code, boolean_type_node, iv0->base, iv1->base);
   if (tem && integer_zerop (tem))
     {
+      if (!every_iteration)
+	return false;
       niter->niter = build_int_cst (unsigned_type_for (type), 0);
       niter->max = 0;
       return true;