https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98598
--- Comment #4 from bin cheng <amker at gcc dot gnu.org> --- Didn't go deep into the case. For simple cases taken as examples, it's possible to interchange the two loops thus enables loop invariant code motion. Though loop interchange may fail because of complicated data dependences, we may take some useful points from it, for example, the cost model checking new loop invariants wrto the outer loop.