tree-scalar-evolution.c (iv_can_overflow_p): export.
authorJan Hubicka <jh@suse.cz>
Thu, 7 Jul 2016 11:50:55 +0000 (13:50 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 7 Jul 2016 11:50:55 +0000 (11:50 +0000)
* tree-scalar-evolution.c (iv_can_overflow_p): export.
* tree-scalar-evolution.h (iv_can_overflow_p): Declare.
* tree-ssa-loop-ivopts.c (alloc_iv): Use it.

From-SVN: r238088

gcc/ChangeLog
gcc/tree-scalar-evolution.c
gcc/tree-scalar-evolution.h
gcc/tree-ssa-loop-ivopts.c

index 75f39de..fca1bac 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-07  Jan Hubicka  <jh@suse.cz>
+
+       * tree-scalar-evolution.c (iv_can_overflow_p): export.
+       * tree-scalar-evolution.h (iv_can_overflow_p): Declare.
+       * tree-ssa-loop-ivopts.c (alloc_iv): Use it.
+
 2016-07-07  Ilya Enkovich  <ilya.enkovich@intel.com>
 
        PR ipa/71624
index e51f0aa..2097d81 100644 (file)
@@ -3317,7 +3317,7 @@ scev_reset (void)
    use this test even for derived IVs not computed every iteration or
    hypotetical IVs to be inserted into code.  */
 
-static bool
+bool
 iv_can_overflow_p (struct loop *loop, tree type, tree base, tree step)
 {
   widest_int nit;
index 8a87660..382d717 100644 (file)
@@ -38,6 +38,7 @@ extern unsigned int scev_const_prop (void);
 extern bool expression_expensive_p (tree);
 extern bool simple_iv (struct loop *, struct loop *, tree, struct affine_iv *,
                       bool);
+extern bool iv_can_overflow_p (struct loop *, tree, tree, tree);
 extern tree compute_overall_effect_of_inner_loop (struct loop *, tree);
 
 /* Returns the basic block preceding LOOP, or the CFG entry block when
index 25b9780..6b403f5 100644 (file)
@@ -1181,6 +1181,10 @@ alloc_iv (struct ivopts_data *data, tree base, tree step,
   iv->biv_p = false;
   iv->nonlin_use = NULL;
   iv->ssa_name = NULL_TREE;
+  if (!no_overflow
+       && !iv_can_overflow_p (data->current_loop, TREE_TYPE (base),
+                             base, step))
+    no_overflow = true;
   iv->no_overflow = no_overflow;
   iv->have_address_use = false;