[PATCH] D85548: Allow fneg + strict_fadd -> strict_fsub in DAGCombiner

Kevin P. Neal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 14 12:23:32 PDT 2020


kpn added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:12824
+  // fold (strict_fadd A, (fneg B)) -> (strict_fsub A, B)
+  if (!LegalOperations || TLI.isOperationLegalOrCustom(ISD::STRICT_FSUB, VT))
+    if (SDValue NegN1 = TLI.getCheaperNegatedExpression(
----------------
arsenm wrote:
> There is some strange legality predicate you are supposed to use for the strict cases, although I don't fully understand it
Where is this predicate? Is there an existing case that can be modeled after?

My thinking is that this transform is probably safe because the FNeg will never trap and it will never round so it should therefore be safe to fold it into the add/sub. But I'm no expert on floating-point I admit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85548



More information about the llvm-commits mailing list