[llvm] r360366 - [CodeGen] Add comment about FSUB <-> FNEG xforms
Cameron McInally via llvm-commits
llvm-commits at lists.llvm.org
Thu May 9 12:28:52 PDT 2019
Author: mcinally
Date: Thu May 9 12:28:52 2019
New Revision: 360366
URL: http://llvm.org/viewvc/llvm-project?rev=360366&view=rev
Log:
[CodeGen] Add comment about FSUB <-> FNEG xforms
Differential Revision: https://reviews.llvm.org/D61741
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=360366&r1=360365&r2=360366&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu May 9 12:28:52 2019
@@ -11629,6 +11629,10 @@ SDValue DAGCombiner::visitFSUB(SDNode *N
}
// (fsub -0.0, N1) -> -N1
+ // NOTE: It is safe to transform an FSUB(-0.0,X) into an FNEG(X), since the
+ // FSUB does not specify the sign bit of a NaN. Also note that for
+ // the same reason, the inverse transform is not safe, unless fast math
+ // flags are in play.
if (N0CFP && N0CFP->isZero()) {
if (N0CFP->isNegative() ||
(Options.NoSignedZerosFPMath || Flags.hasNoSignedZeros())) {
More information about the llvm-commits
mailing list