diff options
author | Chris Lattner <sabre@nondot.org> | 2005-11-09 05:03:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-11-09 05:03:03 +0000 |
commit | b7cad90e55da0900a4d78a416dffdfb516fc68fb (patch) | |
tree | 77da6ec0969c713617781fc088872f716443ca68 /llvm/lib/CodeGen/SelectionDAG | |
parent | 43535a19b12fa36152db638dcd6d441d505d0f34 (diff) | |
download | bcm5719-llvm-b7cad90e55da0900a4d78a416dffdfb516fc68fb.tar.gz bcm5719-llvm-b7cad90e55da0900a4d78a416dffdfb516fc68fb.zip |
Avoid creating a token factor node in trivially redundant cases. This
eliminates almost one node per block in common cases.
llvm-svn: 24254
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index ab176c1f611..ac4a63049cb 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -1234,7 +1234,18 @@ void SelectionDAGISel::BuildSelectionDAG(SelectionDAG &DAG, BasicBlock *LLVMBB, // Turn all of the unordered chains into one factored node. if (!UnorderedChains.empty()) { - UnorderedChains.push_back(SDL.getRoot()); + SDOperand Root = SDL.getRoot(); + if (Root.getOpcode() != ISD::EntryToken) { + unsigned i = 0, e = UnorderedChains.size(); + for (; i != e; ++i) { + assert(UnorderedChains[i].Val->getNumOperands() > 1); + if (UnorderedChains[i].Val->getOperand(0) == Root) + break; // Don't add the root if we already indirectly depend on it. + } + + if (i == e) + UnorderedChains.push_back(Root); + } DAG.setRoot(DAG.getNode(ISD::TokenFactor, MVT::Other, UnorderedChains)); } |