The following makes sure to clear loops number of iterations when
outlining them as part of a SESE region as can happen with
auto-parallelization. The referenced SSA names become stale otherwise.
PR tree-optimization/107865
* tree-cfg.cc (move_sese_region_to_fn): Free the number of
iterations of moved loops.
* gfortran.dg/graphite/pr107865.f90: New testcase.
(cherry picked from commit
bcc2449384f2092cbdf5d6ac2357aeabe3212b2e)
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O1 -floop-parallelize-all -ftree-parallelize-loops=2" }
+
+ SUBROUTINE FNC (F)
+
+ IMPLICIT REAL (A-H)
+ DIMENSION F(N)
+
+ DO I = 1, 6
+ DO J = 1, 6
+ IF (J .NE. I) THEN
+ F(I) = F(I) + 1
+ END IF
+ END DO
+ END DO
+
+ RETURN
+ END
if (bb->loop_father->header == bb)
{
class loop *this_loop = bb->loop_father;
+ /* Avoid the need to remap SSA names used in nb_iterations. */
+ free_numbers_of_iterations_estimates (this_loop);
class loop *outer = loop_outer (this_loop);
if (outer == loop
/* If the SESE region contains some bbs ending with