summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorNirav Dave <niravd@google.com>2018-08-28 18:13:26 +0000
committerNirav Dave <niravd@google.com>2018-08-28 18:13:26 +0000
commit11e39fb6fb608bc145946bca377cac5ac1099c45 (patch)
treec25c435af1043e23ef37860cc6bd329438a66d9a /llvm/lib/CodeGen/SelectionDAG
parent113f2b90588b71f53137395de298122ad10e94d8 (diff)
downloadbcm5719-llvm-11e39fb6fb608bc145946bca377cac5ac1099c45.tar.gz
bcm5719-llvm-11e39fb6fb608bc145946bca377cac5ac1099c45.zip
[DAGCombine] Rework MERGE_VALUES to inline in single pass. NFCI.
Avoid hyperlinear cost of inlining MERGE_VALUE node by constructing temporary vector and doing a single replacement. llvm-svn: 340853
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index b07bed9f736..eb98f75b9fa 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -1859,8 +1859,11 @@ SDValue DAGCombiner::visitMERGE_VALUES(SDNode *N) {
// can be tried again once they have new operands.
AddUsersToWorklist(N);
do {
+ // Do as a single replacement to avoid rewalking use lists.
+ SmallVector<SDValue, 8> Ops;
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i)
- DAG.ReplaceAllUsesOfValueWith(SDValue(N, i), N->getOperand(i));
+ Ops.push_back(N->getOperand(i));
+ DAG.ReplaceAllUsesWith(N, Ops.data());
} while (!N->use_empty());
deleteAndRecombine(N);
return SDValue(N, 0); // Return N so it doesn't get rechecked!
OpenPOWER on IntegriCloud