> > What about the conservative variant of simply > > > > else > > delta = double_int_one; > > I think it would be bad idea: it makes us to completely unroll one interation > too many that bloats code for no benefit. No optimization cancels the path in > CFG because of undefined effect and thus the code will be output (unless > someone > smarter, like VRP, cleans up later, but it is more an exception than rule.)
OK, on deper tought I guess I can add double_int_one always at that spot and once we are done with everything I can walk nb_iter_bound for all statements known to not be executed on last iteration and record them to pointer set. Finally I can walk from header in DFS stopping on loop exits, side effects and those stateemnts. If I visit no loop exit or side effect I know I can lower iteration count by 1 (in estimate_numbers_of_iterations_loop). This will give accurate answer and requires just little extra bookkeeping. I will give this a try. Honza