https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122585
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- As improvement in general the function-level invariant motion pass invocation could be made per loop [nest] instead of per function. Currently a interchange/unroll-and-jam of an unrelated loop can trigger LIM on another loop, but it's not going to be trivial to fully restrict LIM in this way.
