summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-06-08 18:00:46 +0000
committerSanjay Patel <spatel@rotateright.com>2018-06-08 18:00:46 +0000
commit498564e6fbd687efd75577caff5bcb8f71d0e1b4 (patch)
treeafe0f743b0dd82caca4753731b2427495e1a5c3a /llvm/lib/CodeGen/SelectionDAG
parent03f4f04b91faa4b4ebe468313f8d552215515703 (diff)
downloadbcm5719-llvm-498564e6fbd687efd75577caff5bcb8f71d0e1b4.tar.gz
bcm5719-llvm-498564e6fbd687efd75577caff5bcb8f71d0e1b4.zip
[DAGCombiner] clean up comments; NFC
llvm-svn: 334312
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 8b7abdb0395..00ce421e6c6 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -10507,7 +10507,7 @@ SDValue DAGCombiner::visitFMUL(SDNode *N) {
if (N1CFP && N1CFP->isZero())
return N1;
- // fold (fmul (fmul x, c1), c2) -> (fmul x, (fmul c1, c2))
+ // fmul (fmul X, C1), X2 -> fmul X, C1 * C2
if (N0.getOpcode() == ISD::FMUL) {
// Fold scalars or any vector constants (not just splats).
// This fold is done in general by InstCombine, but extra fmul insts
@@ -10531,13 +10531,10 @@ SDValue DAGCombiner::visitFMUL(SDNode *N) {
}
}
- // fold (fmul (fadd x, x), c) -> (fmul x, (fmul 2.0, c))
- // Undo the fmul 2.0, x -> fadd x, x transformation, since if it occurs
- // during an early run of DAGCombiner can prevent folding with fmuls
- // inserted during lowering.
- if (N0.getOpcode() == ISD::FADD &&
- (N0.getOperand(0) == N0.getOperand(1)) &&
- N0.hasOneUse()) {
+ // Match a special-case: we convert X * 2.0 into fadd.
+ // fmul (fadd X, X), C -> fmul X, 2.0 * C
+ if (N0.getOpcode() == ISD::FADD && N0.hasOneUse() &&
+ N0.getOperand(0) == N0.getOperand(1)) {
const SDValue Two = DAG.getConstantFP(2.0, DL, VT);
SDValue MulConsts = DAG.getNode(ISD::FMUL, DL, VT, Two, N1, Flags);
return DAG.getNode(ISD::FMUL, DL, VT, N0.getOperand(0), MulConsts, Flags);
OpenPOWER on IntegriCloud