Use a DenseMap instead of an std::map for the value numbering. This reduces the...
authorOwen Anderson <resistor@mac.com>
Tue, 19 Jun 2007 23:23:54 +0000 (23:23 +0000)
committerOwen Anderson <resistor@mac.com>
Tue, 19 Jun 2007 23:23:54 +0000 (23:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37668 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/GVNPRE.cpp

index 61bc3673cf56eca77dc1735698077b344b187b27..e261d7895fc313c02901a1ae6f151344058237b2 100644 (file)
@@ -25,6 +25,7 @@
 #include "llvm/Function.h"
 #include "llvm/Analysis/Dominators.h"
 #include "llvm/Analysis/PostDominators.h"
+#include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DepthFirstIterator.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Support/CFG.h"
@@ -78,7 +79,7 @@ namespace {
       };
     
     private:
-      std::map<Value*, uint32_t> valueNumbering;
+      DenseMap<Value*, uint32_t> valueNumbering;
       std::map<Expression, uint32_t> expressionNumbering;
   
       std::set<Expression> maximalExpressions;
@@ -217,7 +218,7 @@ ValueTable::Expression::ExpressionOpcode ValueTable::getOpcode(CmpInst* C) {
 uint32_t ValueTable::lookup_or_add(Value* V) {
   maximalValues.insert(V);
 
-  std::map<Value*, uint32_t>::iterator VI = valueNumbering.find(V);
+  DenseMap<Value*, uint32_t>::iterator VI = valueNumbering.find(V);
   if (VI != valueNumbering.end())
     return VI->second;
   
@@ -255,7 +256,7 @@ uint32_t ValueTable::lookup_or_add(Value* V) {
 }
 
 uint32_t ValueTable::lookup(Value* V) {
-  std::map<Value*, uint32_t>::iterator VI = valueNumbering.find(V);
+  DenseMap<Value*, uint32_t>::iterator VI = valueNumbering.find(V);
   if (VI != valueNumbering.end())
     return VI->second;
   else
@@ -265,7 +266,7 @@ uint32_t ValueTable::lookup(Value* V) {
 }
 
 void ValueTable::add(Value* V, uint32_t num) {
-  std::map<Value*, uint32_t>::iterator VI = valueNumbering.find(V);
+  DenseMap<Value*, uint32_t>::iterator VI = valueNumbering.find(V);
   if (VI != valueNumbering.end())
     valueNumbering.erase(VI);
   valueNumbering.insert(std::make_pair(V, num));