[llvm] r300241 - [DAG] Fold away temporary vector in store candidate merge NFC.
Nirav Dave via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 13 13:00:28 PDT 2017
Author: niravd
Date: Thu Apr 13 15:00:27 2017
New Revision: 300241
URL: http://llvm.org/viewvc/llvm-project?rev=300241&view=rev
Log:
[DAG] Fold away temporary vector in store candidate merge NFC.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=300241&r1=300240&r2=300241&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Apr 13 15:00:27 2017
@@ -12276,26 +12276,23 @@ void DAGCombiner::getStoreMergeCandidate
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
More information about the llvm-commits
mailing list