https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112636
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:05e8ef2a05b477589cae25af3311bad0f68a90fe commit r14-7138-g05e8ef2a05b477589cae25af3311bad0f68a90fe Author: Richard Biener <rguent...@suse.de> Date: Thu Jan 11 13:35:51 2024 +0100 tree-optimization/112636 - estimate niters before header copying The following avoids a mismatch between an early query for maximum number of iterations of a loop and a late one when through ranger we'd get iterations estimated. Instead make sure we compute niters before querying the iteration bound. PR tree-optimization/112636 * tree-ssa-loop-ch.cc (ch_base::copy_headers): Call estimate_numbers_of_iterations before querying get_max_loop_iterations_int. (pass_ch::execute): Initialize SCEV and loops appropriately. * gcc.dg/pr112636.c: New testcase.