summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2019-09-12 11:03:09 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2019-09-12 11:03:09 +0000
commitda59a6bf7db11e1b207e1f9bd233d87f9a84dda1 (patch)
tree93e64a5e9922c97eaa8564bb725e729da4b88e97 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parentf2cb4a1842a149b68a94a6c25cbba01987702da7 (diff)
downloadbcm5719-llvm-da59a6bf7db11e1b207e1f9bd233d87f9a84dda1.tar.gz
bcm5719-llvm-da59a6bf7db11e1b207e1f9bd233d87f9a84dda1.zip
[DAGCombine] visitFDIV - Use isCheaperToUseNegatedFPOps helper for (fdiv (fneg X), (fneg Y)) -> (fdiv X, Y). NFCI.
Minor cleanup to use equivalent helper code. llvm-svn: 371724
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index eec3e0848be..1a7cf9e484b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -12687,21 +12687,11 @@ SDValue DAGCombiner::visitFDIV(SDNode *N) {
}
// (fdiv (fneg X), (fneg Y)) -> (fdiv X, Y)
- if (char LHSNeg = isNegatibleForFree(N0, LegalOperations, TLI, &Options,
- ForCodeSize)) {
- if (char RHSNeg = isNegatibleForFree(N1, LegalOperations, TLI, &Options,
- ForCodeSize)) {
- // Both can be negated for free, check to see if at least one is cheaper
- // negated.
- if (LHSNeg == 2 || RHSNeg == 2)
- return DAG.getNode(ISD::FDIV, SDLoc(N), VT,
- GetNegatedExpression(N0, DAG, LegalOperations,
- ForCodeSize),
- GetNegatedExpression(N1, DAG, LegalOperations,
- ForCodeSize),
- Flags);
- }
- }
+ if (isCheaperToUseNegatedFPOps(N0, N1))
+ return DAG.getNode(
+ ISD::FDIV, SDLoc(N), VT,
+ GetNegatedExpression(N0, DAG, LegalOperations, ForCodeSize),
+ GetNegatedExpression(N1, DAG, LegalOperations, ForCodeSize), Flags);
return SDValue();
}
OpenPOWER on IntegriCloud