This might be over the edge of what we want from instcombine, but I'm not sure. There is precedence for factorization transforms in instcombine for FP ops with fast-math.
I think it would take more work to add this to reassociate because that's specialized for binops, and min/max are not binops (or even single instructions). Also, I don't have evidence that larger min/max trees than this exist in real code.
In the motivating example from https://bugs.llvm.org/show_bug.cgi?id=35717 , we have:
int test(int xc, int xm, int xy) { int xk; if (xc < xm) xk = xc < xy ? xc : xy; else xk = xm < xy ? xm : xy; return xk; }
This patch solves that problem because we recognize more min/max patterns after rL321672
https://rise4fun.com/Alive/Qjne
https://rise4fun.com/Alive/3yg
I think that you can easily handle most of the interesting FP cases by checking all of the select pattern results for NaNBehavior == SPNB_NA || NaNBehavior == SPNB_RETURNS_ANY. The other cases will require further thought (so make sure we had the correct relative ordering of all the potentially-NaN inputs).