re PR tree-optimization/88044 (gfortran.dg/transfer_intrinsic_3.f90 hangs after r266171)
authorJakub Jelinek <jakub@redhat.com>
Tue, 22 Jan 2019 09:58:23 +0000 (10:58 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 22 Jan 2019 09:58:23 +0000 (10:58 +0100)
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.

From-SVN: r268143

gcc/ChangeLog
gcc/tree-ssa-loop-niter.c

index 64f920ece339eb40480bfdad55868406f5e6e4fb..feda772ffc6d674f75514f4bdddbbc7bd5af78c4 100644 (file)
@@ -1,5 +1,10 @@
 2019-01-22  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.
+
        PR rtl-optimization/88904
        * cfgcleanup.c (thread_jump): Verify cond2 doesn't mention
        any nonequal registers before processing BB_END (b).
index 622d18abacb512dcce43125c3f366b907d77acf8..470b6a295be5b65e516e4794bbc8a5bbe588aa46 100644 (file)
@@ -1824,6 +1824,8 @@ number_of_iterations_cond (struct loop *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;