[PATCH] D75501: [DAGCombine] Check the uses of negated floating constant and remove the hack

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 06:02:19 PST 2020


spatel added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:5570-5575
+  if (!Op.hasOneUse() &&
+      !(Op.getOpcode() == ISD::FP_EXTEND &&
+        isFPExtFree(VT, Op.getOperand(0).getValueType())) &&
+      !(Op.getOpcode() == ISD::ConstantFP &&
+        !getNegatedExpression(Op, DAG, LegalOperations, ForCodeSize)
+             .hasOneUse()))
----------------
This is difficult to read. Please add some intermediate names (maybe as shown below).

It's not clear to me if that's the logic we want - is this a good or better fix for the problem?

```
  bool IsFreeExtend = Op.getOpcode() == ISD::FP_EXTEND &&
                      isFPExtFree(VT, Op.getOperand(0).getValueType());
  bool IsFreeConstant =
      Op.getOpcode() == ISD::ConstantFP &&
      !getNegatedExpression(Op, DAG, LegalOperations, ForCodeSize).use_empty();
  if (!Op.hasOneUse() && !IsFreeExtend && !IsFreeConstant)
    return NegatibleCost::Expensive;


```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75501





More information about the llvm-commits mailing list