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

Evan Cheng evan.cheng at apple.com
Thu Jun 21 18:36:14 PDT 2007



Changes in directory llvm/lib/CodeGen/SelectionDAG:

ScheduleDAGRRList.cpp updated: 1.30 -> 1.31
---
Log message:

std::set is really really terrible. Switch to SmallPtrSet to reduce compile time. For Duraid's example. The overall isel time is reduced from 0.6255 sec to 0.1876 sec.

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

 ScheduleDAGRRList.cpp |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.30 llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.31
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.30	Thu Apr 26 14:40:56 2007
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp	Thu Jun 21 20:35:51 2007
@@ -118,7 +118,7 @@
 /// it is not the last use of its first operand, add it to the CommuteSet if
 /// possible. It will be commuted when it is translated to a MI.
 void ScheduleDAGRRList::CommuteNodesToReducePressure() {
-  std::set<SUnit *> OperandSeen;
+  SmallPtrSet<SUnit*, 4> OperandSeen;
   for (unsigned i = Sequence.size()-1; i != 0; --i) {  // Ignore first node.
     SUnit *SU = Sequence[i];
     if (!SU) continue;
@@ -680,13 +680,13 @@
 
 // FIXME: This is probably too slow!
 static void isReachable(SUnit *SU, SUnit *TargetSU,
-                        std::set<SUnit *> &Visited, bool &Reached) {
+                        SmallPtrSet<SUnit*, 32> &Visited, bool &Reached) {
   if (Reached) return;
   if (SU == TargetSU) {
     Reached = true;
     return;
   }
-  if (!Visited.insert(SU).second) return;
+  if (!Visited.insert(SU)) return;
 
   for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end(); I != E;
        ++I)
@@ -694,7 +694,7 @@
 }
 
 static bool isReachable(SUnit *SU, SUnit *TargetSU) {
-  std::set<SUnit *> Visited;
+  SmallPtrSet<SUnit*, 32> Visited;
   bool Reached = false;
   isReachable(SU, TargetSU, Visited, Reached);
   return Reached;






More information about the llvm-commits mailing list