diff options
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 13 | 
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);  | 

