tree-optimization/112636 - estimate niters before header copying
commit05e8ef2a05b477589cae25af3311bad0f68a90fe
authorRichard Biener <rguenther@suse.de>
Thu, 11 Jan 2024 12:35:51 +0000 (11 13:35 +0100)
committerRichard Biener <rguenther@suse.de>
Thu, 11 Jan 2024 13:45:11 +0000 (11 14:45 +0100)
treedcda854c265f423f56c5dac19acdf015c660ba42
parentb793c21892be7c11e628b1949fe9ec0c041e0fdc
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.
gcc/testsuite/gcc.dg/pr112636.c [new file with mode: 0644]
gcc/tree-ssa-loop-ch.cc