Hi,
This is an obvious change to bypass following iterations if expr has already
been simplified into constant in function
simplify_using_loop_initial_conditions.

Is it OK?

Thanks,
bin

2015-07-28  Bin Cheng  <bin.ch...@arm.com>

        * tree-ssa-loop-niter.c (simplify_using_initial_conditions): Break
        Loop if EXPR is simplified to const values.
Index: gcc/tree-ssa-loop-niter.c
===================================================================
--- gcc/tree-ssa-loop-niter.c   (revision 225859)
+++ gcc/tree-ssa-loop-niter.c   (working copy)
@@ -1815,6 +1815,10 @@ simplify_using_initial_conditions (struct loop *lo
       if (e->flags & EDGE_FALSE_VALUE)
        cond = invert_truthvalue (cond);
       expr = tree_simplify_using_condition (cond, expr);
+      /* Break if EXPR is simplified to const values.  */
+      if (expr && (integer_zerop (expr) || integer_nonzerop (expr)))
+       break;
+
       ++cnt;
     }
 

Reply via email to