From: Kugan Vivekanandarajah Date: Fri, 6 Jul 2018 22:12:52 +0000 (+0000) Subject: tree-ssa-loop-niter.c (number_of_iterations_popcount): If popcount argument is checke... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b8b31957e4c7e28fc44ae1b1ce658ba49ff1aa18;p=gcc.git tree-ssa-loop-niter.c (number_of_iterations_popcount): If popcount argument is checked for zero before entering loop, avoid checking again. gcc/ChangeLog: 2018-07-06 Kugan Vivekanandarajah * 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index acaea119eaf..10137d6b411 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-07-06 Kugan Vivekanandarajah + + * 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 * gimplify.h (generic_expr_could_trap_p): Set as global function. diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 03588a012bd..f6fa2f74744 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -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;