This fixes PR53031 and reverts back to using the number of latch iterations in VRP when computing ranges for induction variables. Now after ira_allocno_object_iter_cond is fixed this no longer breaks bootstrap.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Richard. 2012-04-19 Richard Guenther <rguent...@suse.de> PR tree-optimization/53031 * tree-vrp.c (adjust_range_with_scev): Revert back to using max_loop_iterations. Index: gcc/tree-vrp.c =================================================================== --- gcc/tree-vrp.c (revision 186589) +++ gcc/tree-vrp.c (working copy) @@ -3420,7 +3420,9 @@ adjust_range_with_scev (value_range_t *v { double_int nit; - if (max_stmt_executions (loop, &nit)) + /* We are only entering here for loop header PHI nodes, so using + the number of latch executions is the correct thing to use. */ + if (max_loop_iterations (loop, &nit)) { value_range_t maxvr = { VR_UNDEFINED, NULL_TREE, NULL_TREE, NULL }; double_int dtmp;