[llvm] r234118 - [DAGCombiner] Merge FMUL Scalar and Vector constant canonicalization to RHS. NFCI.
Simon Pilgrim
llvm-dev at redking.me.uk
Sun Apr 5 07:30:38 PDT 2015
Author: rksimon
Date: Sun Apr 5 09:30:37 2015
New Revision: 234118
URL: http://llvm.org/viewvc/llvm-project?rev=234118&view=rev
Log:
[DAGCombiner] Merge FMUL Scalar and Vector constant canonicalization to RHS. NFCI.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=234118&r1=234117&r2=234118&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sun Apr 5 09:30:37 2015
@@ -7539,13 +7539,6 @@ SDValue DAGCombiner::visitFMUL(SDNode *N
// This just handles C1 * C2 for vectors. Other vector folds are below.
if (SDValue FoldedVOp = SimplifyVBinOp(N))
return FoldedVOp;
-
- // Canonicalize vector constant to RHS.
- if (N0.getOpcode() == ISD::BUILD_VECTOR &&
- N1.getOpcode() != ISD::BUILD_VECTOR)
- if (auto *BV0 = dyn_cast<BuildVectorSDNode>(N0))
- if (BV0->isConstant())
- return DAG.getNode(N->getOpcode(), SDLoc(N), VT, N1, N0);
}
// fold (fmul c1, c2) -> c1*c2
@@ -7553,7 +7546,8 @@ SDValue DAGCombiner::visitFMUL(SDNode *N
return DAG.getNode(ISD::FMUL, SDLoc(N), VT, N0, N1);
// canonicalize constant to RHS
- if (N0CFP && !N1CFP)
+ if (isConstantFPBuildVectorOrConstantFP(N0) &&
+ !isConstantFPBuildVectorOrConstantFP(N1))
return DAG.getNode(ISD::FMUL, SDLoc(N), VT, N1, N0);
// fold (fmul A, 1.0) -> A
More information about the llvm-commits
mailing list