The following fixes a common mistake in calling
analyze_scalar_evolution -- it's supposed to be called with the loop
the use is directly in.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2017-10-11  Richard Biener  <rguent...@suse.de>

        * tree-ssa-loop-niter.c (infer_loop_bounds_from_pointer_arith):
        Properly call analyze_scalar_evolution with the loop of the stmt.

Index: gcc/tree-ssa-loop-niter.c
===================================================================
--- gcc/tree-ssa-loop-niter.c   (revision 253642)
+++ gcc/tree-ssa-loop-niter.c   (working copy)
@@ -3444,7 +3444,8 @@ infer_loop_bounds_from_pointer_arith (st
   if (TYPE_PRECISION (type) != TYPE_PRECISION (TREE_TYPE (var)))
     return;
 
-  scev = instantiate_parameters (loop, analyze_scalar_evolution (loop, def));
+  struct loop *uloop = loop_containing_stmt (stmt);
+  scev = instantiate_parameters (loop, analyze_scalar_evolution (uloop, def));
   if (chrec_contains_undetermined (scev))
     return;
 

Reply via email to