[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Nov 8 21:03:15 PST 2005
Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAGISel.cpp updated: 1.94 -> 1.95
---
Log message:
Avoid creating a token factor node in trivially redundant cases. This
eliminates almost one node per block in common cases.
---
Diffs of the changes: (+12 -1)
SelectionDAGISel.cpp | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletion(-)
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.94 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.95
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.94 Tue Nov 8 22:45:33 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Nov 8 23:03:03 2005
@@ -1234,7 +1234,18 @@
// 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));
}
More information about the llvm-commits
mailing list