This is similar to D76853. Current implementation of division estimation isn't correct for 1.0/0.0 (result is nan, not expected inf).
And this change exposes a potential infinite loop: in combineRepeatedFPDivisors, we use isConstOrConstSplatFP to look up if the divisor is some constant. But it doesn't work after legalized on some platforms. This patch restricts the method to act before LegalDAG.
Do we need to check the target option here? If all tests are updated to use node-level fast-math-flags, then I would prefer not to include legacy/deprecated predicate.