Loop invariant code motion can pull an fdiv out of by putting a reciprocal outside and using an fmul inside. InstCombine shouldn't reverse that.
I just did a simple basic block parent check rather than checking for the loop. I can call getLoop and isInvariant if we think that would be better.
I found another variation of this
(X/Y) outside loop
Mul with Z inside loop.
->
X*Z ends up inside loop
/ Y ends up in loop
->
recip of Y outside loop
X*Z in loop
mul with reciprocal of Y inside loop.
So we went from an fdiv outside loop and one fmul inside the loop to 1 div outside the loop and 2 fmuls inside the loop.