make gvn marginally faster by reallocating the lastSeenLoad map for
authorChris Lattner <sabre@nondot.org>
Fri, 21 Mar 2008 21:33:23 +0000 (21:33 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 21 Mar 2008 21:33:23 +0000 (21:33 +0000)
each basic block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48660 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/GVN.cpp

index 077fa67e0bd0ae16a68fcacad662b4260fd04dd8..eb91b5a043d160dfda33775c051c5d785cc8aa96 100644 (file)
@@ -1287,15 +1287,16 @@ bool GVN::iterateOnFunction(Function &F) {
   DominatorTree &DT = getAnalysis<DominatorTree>();   
   
   SmallVector<Instruction*, 4> toErase;
-  
+  DenseMap<Value*, LoadInst*> lastSeenLoad;
+
   // Top-down walk of the dominator tree
   for (df_iterator<DomTreeNode*> DI = df_begin(DT.getRootNode()),
          E = df_end(DT.getRootNode()); DI != E; ++DI) {
     
     // Get the set to update for this block
     ValueNumberedSet& currAvail = availableOut[DI->getBlock()];     
-    DenseMap<Value*, LoadInst*> lastSeenLoad;
-    
+    lastSeenLoad.clear();
+
     BasicBlock* BB = DI->getBlock();
   
     // A block inherits AVAIL_OUT from its dominator