Currently IndVarSimplify breaks LCSSA on inner loops even though it says
it preserves LCSSA. Fix this by running formLCSSARecursively
explictly on the inner loops.
Fixes PR25578 and PR24804.
There are couple of ways we can make this logic more frugal if needed:
- Inspect only newly inserted / moved instructions for possible LCSSA breakage
- Teach SCEVExpander to not break LCSSA for any loop in the loop nest
Test cases courtesy of David Majnemer and Michael Zolotukhin!
This does not seem to be documented explicitly anywhere, could you also add some comments in SCEVExpander's header file to this effect as well.