[PATCH] DAGCombine: constant fold FMA

Mehdi AMINI mehdi.amini at apple.com
Sat Jan 10 11:13:58 PST 2015


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 target to perform its own combine.


http://reviews.llvm.org/D6912

Files:
  lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Index: lib/CodeGen/SelectionDAG/SelectionDAG.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -3593,6 +3593,8 @@
         V1.fusedMultiplyAdd(V2, V3, APFloat::rmNearestTiesToEven);
       if (s != APFloat::opInvalidOp)
         return getConstantFP(V1, VT);
+      else // Bail out now to allow the target to try its own cst folding
+        return SDValue();
     }
     break;
   }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6912.17973.patch
Type: text/x-patch
Size: 502 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150110/ab2a1355/attachment.bin>


More information about the llvm-commits mailing list