[PATCH] D130232: Reassoc FMF should not optimize FMA(a, 0, b) to (b)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 24 14:04:22 PDT 2022


spatel added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:15036
 
-  if (UnsafeFPMath) {
+  if (Options.UnsafeFPMath) {
     if (N0CFP && N0CFP->isZero())
----------------
We are slowly trying to get away from using the global settings by replacing those checks with fast-math-flags. Can we do that here?

This should match the conditions that we use to simplify X * 0.0. That's done via DAG.simplifyFPBinop():

  // X * 0.0 --> 0.0
  if (Opcode == ISD::FMUL && Flags.hasNoNaNs() && Flags.hasNoSignedZeros())
    if (YC->getValueAPF().isZero())
      return getConstantFP(0.0, SDLoc(Y), Y.getValueType());



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130232/new/

https://reviews.llvm.org/D130232



More information about the llvm-commits mailing list