tree-ssa-loop-niter.c (simplify_using_initial_conditions): Break loop if EXPR is...
authorBin Cheng <bin.cheng@arm.com>
Fri, 21 Aug 2015 10:09:48 +0000 (10:09 +0000)
committerBin Cheng <amker@gcc.gnu.org>
Fri, 21 Aug 2015 10:09:48 +0000 (10:09 +0000)
* tree-ssa-loop-niter.c (simplify_using_initial_conditions): Break
loop if EXPR is simplified to const value.

From-SVN: r227055

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

index c746e164363ac0d9eaf477259717fd2155817764..cb1ed43dae7c61497fda0e522f42f0f965cb338a 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-21  Bin Cheng  <bin.cheng@arm.com>
+
+       * tree-ssa-loop-niter.c (simplify_using_initial_conditions): Break
+       loop if EXPR is simplified to const value.
+
 2015-08-21  Yury Gribov  <y.gribov@samsung.com>
 
        * sanitizer.def (BUILT_IN_UBSAN_HANDLE_NONNULL_ARG,
index 4e9a2acb19d0987d8d0337fcab027ab3eb5c6890..39d68072240309b4603c2c05e3afc9a860a60c47 100644 (file)
@@ -2083,6 +2083,10 @@ simplify_using_initial_conditions (struct loop *loop, tree expr)
       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;
     }