[llvm] r226901 - DAGCombine: always constant fold FMA when target disable FP exceptions

Mehdi Amini mehdi.amini at apple.com
Thu Jan 22 23:07:21 PST 2015


Author: mehdi_amini
Date: Fri Jan 23 01:07:20 2015
New Revision: 226901

URL: http://llvm.org/viewvc/llvm-project?rev=226901&view=rev
Log:
DAGCombine: always constant fold FMA when target disable FP exceptions

Summary: When trying to constant fold an FMA in the DAG, getNode()
fails to fold the FMA if an operand is not finite. In this case this
patch allows the constant folding if !TLI->hasFloatingPointExceptions()

Reviewers: resistor

Reviewed By: resistor

Subscribers: hfinkel, llvm-commits

Differential Revision: http://reviews.llvm.org/D6912

From: Mehdi Amini <mehdi.amini at apple.com>

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=226901&r1=226900&r2=226901&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Jan 23 01:07:20 2015
@@ -3620,7 +3620,7 @@ SDValue SelectionDAG::getNode(unsigned O
       const APFloat &V3 = N3CFP->getValueAPF();
       APFloat::opStatus s =
         V1.fusedMultiplyAdd(V2, V3, APFloat::rmNearestTiesToEven);
-      if (s != APFloat::opInvalidOp)
+      if (!TLI->hasFloatingPointExceptions() || s != APFloat::opInvalidOp)
         return getConstantFP(V1, VT);
     }
     break;





More information about the llvm-commits mailing list