https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83695
--- Comment #4 from amker at gcc dot gnu.org --- Given 3-level loop nest: <outer:Loop_1, Loop_2, Loop_3:inner>, the ICE happens when estimate_numbers_of_iterations called for the outermost Loop_1. The function tries to infer niter information from all stmts inside the loop. In this case, the scev_info for variables defined in innermost loop is not updated in previous interchange. If I deliberately call estimate_numbers_of_iterations for all loops in nest before actual interchange, the ICE will be gone. But I am not sure if this is the only case outdated scev info in inner loops is used. A full fix would be introducing additional interface cleaning up cached scev information for variables defined in LOOP from scalar_evolution_info. And call the interface for interchanged loops. Given interchange executed for only limited times, I guess that won't be too expensive? I am testing a patch following the latter method.