https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77975
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Author: jakub Date: Fri Mar 10 07:53:57 2017 New Revision: 246021 URL: https://gcc.gnu.org/viewcvs?rev=246021&root=gcc&view=rev Log: PR tree-optimization/77975 * tree-ssa-loop-niter.c (get_base_for): Allow phi argument from latch edge to be constant. (get_val_for): For constant x return it. Formatting fix. (loop_niter_by_eval): Avoid pointless looping if the next iteration would use the same bases as the current one. * gcc.dg/pr77975.c: New test. Added: trunk/gcc/testsuite/gcc.dg/pr77975.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-loop-niter.c