diff options
author | Owen Anderson <resistor@mac.com> | 2012-05-02 21:32:35 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2012-05-02 21:32:35 +0000 |
commit | 363e4b90c0a8dfca87ac847001158c743491c06f (patch) | |
tree | 298a6f6456c4bede793a06dbc89bd21188b08005 /lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | 4599613dec76683aa1630a4a02082e0dc8ec2706 (diff) |
Teach DAG combine that multiplication by 1.0 can always be constant folded.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156023 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index e72c8d5f2d..b8f08bf018 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -5715,6 +5715,9 @@ SDValue DAGCombiner::visitFMUL(SDNode *N) { if (DAG.getTarget().Options.UnsafeFPMath && ISD::isBuildVectorAllZeros(N1.getNode())) return N1; + // fold (fmul A, 1.0) -> A + if (N1CFP && N1CFP->isExactlyValue(1.0)) + return N0; // fold (fmul X, 2.0) -> (fadd X, X) if (N1CFP && N1CFP->isExactlyValue(+2.0)) return DAG.getNode(ISD::FADD, N->getDebugLoc(), VT, N0, N0); |