tree-ssa-loop-niter.c (number_of_iterations_popcount): If popcount argument is checke...
authorKugan Vivekanandarajah <kuganv@linaro.org>
Fri, 6 Jul 2018 22:12:52 +0000 (22:12 +0000)
committerKugan Vivekanandarajah <kugan@gcc.gnu.org>
Fri, 6 Jul 2018 22:12:52 +0000 (22:12 +0000)
gcc/ChangeLog:

2018-07-06  Kugan Vivekanandarajah  <kuganv@linaro.org>

* tree-ssa-loop-niter.c (number_of_iterations_popcount): If popcount
argument is checked for zero before entering loop, avoid checking again.

From-SVN: r262487

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

index acaea119eaf40dbf90d2b7173926056c7a74add4..10137d6b4114f7286c44887eb63b01d8a355f1e1 100644 (file)
@@ -1,3 +1,8 @@
+2018-07-06  Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+       * tree-ssa-loop-niter.c (number_of_iterations_popcount): If popcount
+       argument is checked for zero before entering loop, avoid checking again.
+
 2018-07-06  Kugan Vivekanandarajah  <kuganv@linaro.org>
 
        * gimplify.h (generic_expr_could_trap_p): Set as global function.
index 03588a012bdd9362458a061cc9c90304cc376f9c..f6fa2f74744074730ad3a910d92bf4f11dd7db01 100644 (file)
@@ -2596,10 +2596,15 @@ number_of_iterations_popcount (loop_p loop, edge exit,
 
   niter->niter = iter;
   niter->assumptions = boolean_true_node;
+
   if (adjust)
-    niter->may_be_zero = fold_build2 (EQ_EXPR, boolean_type_node, src,
+    {
+      tree may_be_zero = fold_build2 (EQ_EXPR, boolean_type_node, src,
                                      build_zero_cst
                                      (TREE_TYPE (src)));
+      niter->may_be_zero =
+       simplify_using_initial_conditions (loop, may_be_zero);
+    }
   else
     niter->may_be_zero = boolean_false_node;