[DAG] Fold away temporary vector in store candidate merge NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300241 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nirav Dave 2017-04-13 20:00:27 +00:00
parent 14eaa3c97f
commit 042486c448

View File

@ -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