diff options
author | Nirav Dave <niravd@google.com> | 2017-04-13 20:00:27 +0000 |
---|---|---|
committer | Nirav Dave <niravd@google.com> | 2017-04-13 20:00:27 +0000 |
commit | 9acd2fd9d98bb99847aeaeea0016132bdae42395 (patch) | |
tree | d40e3e7897f9c2b7e16e8da21834f115d7607a01 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | 2c7ca9b5df41332b32adec1def081f48ab6ec5d7 (diff) | |
download | bcm5719-llvm-9acd2fd9d98bb99847aeaeea0016132bdae42395.tar.gz bcm5719-llvm-9acd2fd9d98bb99847aeaeea0016132bdae42395.zip |
[DAG] Fold away temporary vector in store candidate merge NFC.
llvm-svn: 300241
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 306c1974ab5..c947201da2a 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -12276,26 +12276,23 @@ void DAGCombiner::getStoreMergeCandidates( SDNode *RootNode = (St->getChain()).getNode(); - // Set of Parents of Candidates - std::set<SDNode *> CandidateParents; - - if (LoadSDNode *Ldn = dyn_cast<LoadSDNode>(RootNode)) { - RootNode = Ldn->getChain().getNode(); - for (auto I = RootNode->use_begin(), E = RootNode->use_end(); I != E; ++I) - if (I.getOperandNo() == 0 && isa<LoadSDNode>(*I)) // walk down chain - CandidateParents.insert(*I); - } else - CandidateParents.insert(RootNode); - - // check all parents of mergable children - for (auto P = CandidateParents.begin(); P != CandidateParents.end(); ++P) - for (auto I = (*P)->use_begin(), E = (*P)->use_end(); I != E; ++I) + auto FindInNode = [&](SDNode *P) { + for (auto I = P->use_begin(), E = P->use_end(); I != E; ++I) if (I.getOperandNo() == 0) if (StoreSDNode *OtherST = dyn_cast<StoreSDNode>(*I)) { BaseIndexOffset Ptr; if (CandidateMatch(OtherST, Ptr)) StoreNodes.push_back(MemOpLink(OtherST, Ptr.Offset)); } + }; + + if (LoadSDNode *Ldn = dyn_cast<LoadSDNode>(RootNode)) { + RootNode = Ldn->getChain().getNode(); + for (auto I = RootNode->use_begin(), E = RootNode->use_end(); I != E; ++I) + if (I.getOperandNo() == 0 && isa<LoadSDNode>(*I)) // walk down chain + FindInNode(*I); + } else + FindInNode(RootNode); } // We need to check that merging these stores does not cause a loop |