[PATCH] D28675: [DAGCombine] require UnsafeFPMath for re-association of addition

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 13 08:50:22 PST 2017


arsenm added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:8136-8140
   if ((AllowFusion || HasFMAD)  && Aggressive) {
     // fold (fadd (fma x, y, (fmul u, v)), z) -> (fma x, y (fma u, v, z))
-    if (N0.getOpcode() == PreferredFusedOpcode &&
+    if (Options.UnsafeFPMath &&
+        N0.getOpcode() == PreferredFusedOpcode &&
         N0.getOperand(2).getOpcode() == ISD::FMUL) {
----------------
I think this should be replacing the (AllowFusion || HasFMAD) check and then picking the right opcode inside


https://reviews.llvm.org/D28675





More information about the llvm-commits mailing list