diff mbox series

Fix infer_loop_bounds_from_pointer_arith

Message ID alpine.LSU.2.20.1710111519330.6597@zhemvz.fhfr.qr
State New
Headers show
Series Fix infer_loop_bounds_from_pointer_arith | expand

Commit Message

Richard Biener Oct. 11, 2017, 1:20 p.m. UTC
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  <rguenther@suse.de>

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

Patch

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;