In http://reviews.llvm.org/D6911, we allowed GVN to propagate FP equalities to allow some simple value range optimizations. But that introduced a bug when comparing to -0.0 or 0.0: these compare equal even though they are not bitwise identical.
This patch disallows propagating zero constants in equality comparisons. As shown in http://llvm.org/bugs/show_bug.cgi?id=22376, we can miscompile with the current optimization.
I also checked to make sure that NaN comparisons are handled, and they always appear to be correctly optimized by SimplifyInstruction.