[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner sabre at nondot.org
Thu Feb 15 11:42:09 PST 2007



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.633 -> 1.634
---
Log message:

switch an std::set to a SmallPtr set, this speeds up instcombine by 9.5%
on 447.dealII


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

 InstructionCombining.cpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.633 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.634
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.633	Wed Feb 14 20:26:10 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Thu Feb 15 13:41:52 2007
@@ -51,6 +51,7 @@
 #include "llvm/Support/PatternMatch.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/STLExtras.h"
 #include <algorithm>
@@ -9088,11 +9089,11 @@
 /// whose condition is a known constant, we only visit the reachable successors.
 ///
 static void AddReachableCodeToWorklist(BasicBlock *BB, 
-                                       std::set<BasicBlock*> &Visited,
+                                       SmallPtrSet<BasicBlock*, 64> &Visited,
                                        std::vector<Instruction*> &WorkList,
                                        const TargetData *TD) {
   // We have now visited this block!  If we've already been here, bail out.
-  if (!Visited.insert(BB).second) return;
+  if (!Visited.insert(BB)) return;
     
   for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E; ) {
     Instruction *Inst = BBI++;
@@ -9154,7 +9155,7 @@
     // Do a depth-first traversal of the function, populate the worklist with
     // the reachable instructions.  Ignore blocks that are not reachable.  Keep
     // track of which blocks we visit.
-    std::set<BasicBlock*> Visited;
+    SmallPtrSet<BasicBlock*, 64> Visited;
     AddReachableCodeToWorklist(F.begin(), Visited, WorkList, TD);
 
     // Do a quick scan over the function.  If we find any blocks that are






More information about the llvm-commits mailing list