[PATCH] D44521: [InstSimplify] fp_binop X, NaN --> NaN
Mikhail Dvoretckii via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 16 09:07:29 PDT 2018
mike.dvoretsky added inline comments.
================
Comment at: lib/Analysis/InstructionSimplify.cpp:4154
+ if (isa<UndefValue>(Op0) || isa<UndefValue>(Op1))
+ return ConstantFP::getNaN(Op0->getType());
+
----------------
Why are we emitting NaNs from an undef operand here?
================
Comment at: lib/Analysis/InstructionSimplify.cpp:4157
+ if (match(Op0, m_NaN()) || match(Op1, m_NaN()))
+ return ConstantFP::getNaN(Op0->getType());
+
----------------
According to IEEE 754, we should preserve the payload bits of the NaN operand here (either one if both are NaN). This code creates a NaN with all payload bits unset instead.
https://reviews.llvm.org/D44521
More information about the llvm-commits
mailing list