diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2015-07-17 01:14:35 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2015-07-17 01:14:35 +0000 |
commit | cabe02e14110526189a0935d172f8547f0232572 (patch) | |
tree | add132accc8233b4ab9384704ea599d531240f68 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | d07f7550a9f699927c93e0eb9a4f03b72cbd9bdd (diff) | |
download | bcm5719-llvm-cabe02e14110526189a0935d172f8547f0232572.tar.gz bcm5719-llvm-cabe02e14110526189a0935d172f8547f0232572.zip |
Only do fmul (fadd x, x), c combine if the fadd only has one use
This was increasing the instruction count if the fadd has multiple uses.
llvm-svn: 242498
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 465329371f3..f49b53e3b81 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -8138,7 +8138,9 @@ SDValue DAGCombiner::visitFMUL(SDNode *N) { // 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)) { + if (N0.getOpcode() == ISD::FADD && + (N0.getOperand(0) == N0.getOperand(1)) && + N0.hasOneUse()) { const SDValue Two = DAG.getConstantFP(2.0, DL, VT); SDValue MulConsts = DAG.getNode(ISD::FMUL, DL, VT, Two, N1); return DAG.getNode(ISD::FMUL, DL, VT, N0.getOperand(0), MulConsts); |