[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Chris Lattner sabre at nondot.org
Sat Feb 3 16:24:57 PST 2007



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAG.cpp updated: 1.381 -> 1.382
---
Log message:

Eliminate some std::sets.  This speeds up isel of kimwitu by about 0.9%


---
Diffs of the changes:  (+6 -6)

 SelectionDAG.cpp |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.381 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.382
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.381	Sat Feb  3 18:14:31 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Sat Feb  3 18:24:41 2007
@@ -24,9 +24,9 @@
 #include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/ADT/SetVector.h"
+#include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
-#include <set>
 #include <algorithm>
 #include <cmath>
 using namespace llvm;
@@ -2548,12 +2548,12 @@
 
   SDOperand TheValue(const_cast<SDNode *>(this), Value);
 
-  std::set<SDNode*> UsersHandled;
+  SmallPtrSet<SDNode*, 32> UsersHandled;
 
   for (SDNode::use_iterator UI = Uses.begin(), E = Uses.end(); UI != E; ++UI) {
     SDNode *User = *UI;
     if (User->getNumOperands() == 1 ||
-        UsersHandled.insert(User).second)     // First time we've seen this?
+        UsersHandled.insert(User))     // First time we've seen this?
       for (unsigned i = 0, e = User->getNumOperands(); i != e; ++i)
         if (User->getOperand(i) == TheValue) {
           if (NUses == 0)
@@ -2599,8 +2599,8 @@
 }
 
 static void findPredecessor(SDNode *N, const SDNode *P, bool &found,
-                            std::set<SDNode *> &Visited) {
-  if (found || !Visited.insert(N).second)
+                            SmallPtrSet<SDNode *, 32> &Visited) {
+  if (found || !Visited.insert(N))
     return;
 
   for (unsigned i = 0, e = N->getNumOperands(); !found && i != e; ++i) {
@@ -2618,7 +2618,7 @@
 /// up the operands.
 /// NOTE: this is an expensive method. Use it carefully.
 bool SDNode::isPredecessor(SDNode *N) const {
-  std::set<SDNode *> Visited;
+  SmallPtrSet<SDNode *, 32> Visited;
   bool found = false;
   findPredecessor(N, this, found, Visited);
   return found;






More information about the llvm-commits mailing list