As discussed in the commit thread for rGa253a2a and D73978, we can do more undef folding for FP ops. The nnan and ninf fast-math-flags specify that if an operand is the disallowed value, the result is poison, so we can produce an undef result.
But this doesn't work as expected (the undef operand cases remain) because of a Flags propagation problem in SelectionDAGBuilder.
I've added DAGCombiner calls to enable these for the other cases because we've shown in other patches that (because of the limited way that SDAG iterates), it is possible to miss simplifications like this if they are done only at node creation time.
Nit: I think it is opposite; poison -> undef is allowed, but undef -> poison is not allowed. LangRef says a poison value may be relaxed into an undef value, which takes an arbitrary bit-pattern.