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

Chris Lattner sabre at nondot.org
Mon Mar 26 13:41:07 PDT 2007



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.694 -> 1.695
---
Log message:

eliminate use of std::set


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

 InstructionCombining.cpp |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.694 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.695
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.694	Mon Mar 26 12:44:01 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Mon Mar 26 15:40:50 2007
@@ -56,10 +56,7 @@
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/STLExtras.h"
 #include <algorithm>
-#include <set>
-#ifndef NDEBUG
 #include <sstream>
-#endif
 using namespace llvm;
 using namespace llvm::PatternMatch;
 
@@ -7808,12 +7805,13 @@
 
 /// DeadPHICycle - Return true if this PHI node is only used by a PHI node cycle
 /// that is dead.
-static bool DeadPHICycle(PHINode *PN, std::set<PHINode*> &PotentiallyDeadPHIs) {
+static bool DeadPHICycle(PHINode *PN,
+                         SmallPtrSet<PHINode*, 16> &PotentiallyDeadPHIs) {
   if (PN->use_empty()) return true;
   if (!PN->hasOneUse()) return false;
 
   // Remember this node, and if we find the cycle, return.
-  if (!PotentiallyDeadPHIs.insert(PN).second)
+  if (!PotentiallyDeadPHIs.insert(PN))
     return true;
 
   if (PHINode *PU = dyn_cast<PHINode>(PN->use_back()))
@@ -7844,7 +7842,7 @@
   if (PN.hasOneUse()) {
     Instruction *PHIUser = cast<Instruction>(PN.use_back());
     if (PHINode *PU = dyn_cast<PHINode>(PHIUser)) {
-      std::set<PHINode*> PotentiallyDeadPHIs;
+      SmallPtrSet<PHINode*, 16> PotentiallyDeadPHIs;
       PotentiallyDeadPHIs.insert(&PN);
       if (DeadPHICycle(PU, PotentiallyDeadPHIs))
         return ReplaceInstUsesWith(PN, UndefValue::get(PN.getType()));






More information about the llvm-commits mailing list